【題目敘述】http://codeforces.com/contest/1207/problem/F
#include <iostream>
using namespace std;
int q, a[500005], t, x, y, b[700][700];
int main() {
cin >> q;
for (int i = 0; i < q; i++){
cin >> t >> x >> y;
if (t == 1){
a[x] += y;
for (int j = 1; j < 700; j++){
b[j][x%j] += y;
}
}
else {
if (x < 700) cout << b[x][y] << "\n";
else {
int ans = 0;
for (int j = y; j < 500005; j += x){
ans += a[j];
}
cout << ans << "\n";
}
}
}
}