#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, j, k = 0, x = 0, y = 0, i, c = 0;     cin >> m;     int a[500001] = {0};     int ans[1000][1000] = {0};     while (m--) {       cin >> n >> x >> y;       if (n == 1) {         a[x] += y;         for (i = 1; i < 1000; i++) ans[i][x % i] += y;       } else {         if (x < 1000) {           cout << ans[x][y] << endl;         } else {           c = 0;           for (i = y; i < 500001; i += x) c += a[i];           cout << c << endl;         }       }     }   }   