#include <bits/stdc++.h>   using namespace std;   const int N = 500010;   int A[N];   const int S = 250;   int sum[S][S];   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int Q;     cin >> Q;     while (Q--) {       int t, x, y;       cin >> t >> x >> y;       if (t == 1) {         A[x] += y;         for (int m = 1; m < S; m++) {           sum[m][x % m] += y;         }       } else {         int ans = 0;         if (x < S) {           ans = sum[x][y];         } else {           for (int i = y; i < N; i += x) {             ans += A[i];           }         }         cout << ans <<   n ;       }     }     return 0;   }   