因为学术没人所以发灌水了。
#include<bits/stdc++.h>
#define int long long
using namespace std;
int q,opt,x,y,a[500010],sum[710][710],ans;//sqrt(500000)=708
main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>q;
while(q--)
{
cin>>opt>>x>>y;
if(opt==1)
{
a[x]+=y;
for(int i=1;i<=708;i++) sum[i][x%i]+=y;
}
if(opt==2)
{
if(x<=708) cout<<sum[x][y%x]<<endl;
if(x>708)
{
ans=0;
for(int i=y;i<=500000;i+=x) ans+=a[i];
cout<<ans<<endl;
}
}
}
return 0;
}