#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
long long q, m, a[N], ans[1000][1000], x, y, ans1, ty, idx, val;
int main() {
  std::ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> q;
  m = 710;
  while (q--) {
    cin >> ty;
    if (ty == 1) {
      cin >> idx >> val;
      a[idx] += val;
      for (int i = 1; i <= m; i++) {
        ans[i][idx % i] += val;
      }
      continue;
    }
    cin >> x >> y;
    ans1 = 0;
    if (x >= m) {
      for (int i = y; i <= N - 1; i += x) {
        ans1 += a[i];
      }
      cout << ans1 << " ";
      continue;
    }
    cout << ans[x][y] << " ";
  }
}
