#include
using namespace std;
struct seg { int v, l, r; seg *ls, *rs; };
const int maxn = 70009; const int maxb = 23; const int maxseg = maxn * maxb * 3;
int n, m, bv, a[maxn]; seg *br[maxb][maxb], sbuf_arr[maxseg], *sbuf(sbuf_arr);
#define midp(p) ((p->l+p->r)»1) inline seg* sgtBuild(int l, int r) { seg* p(sbuf ++); p-> l = l; p-> r = r; p-> v = 0; if (l + 1 < r) { p-> ls = sgtBuild(l, midp(p)); p-> rs = sgtBuild(midp(p), r); } return p; } inline void sgtChg(seg* p, int po, int vo) { if (p-> l + 1 == p-> r) p-> v += vo; else { if (po < midp(p)) sgtChg(p-> ls, po, vo); else sgtChg(p-> rs, po, vo); p-> v = max(p-> ls-> v, p-> rs-> v); } }
int main() { #ifndef ONLINE_JUDGE freopen(".in", “r”, stdin); #endif
scanf("%d", &n);
bv = 10;
for (int i = 1; i <= bv; ++ i)
for (int j = 0; j < i; ++ j)
br[i][j] = sgtBuild(0, n / i + 1);
for (int i = 1; i <= n; ++ i) {
scanf("%d", a + (n - i));
for (int j = 1; j <= bv; ++ j)
sgtChg(br[j][(n - i) % j], (n - i) / j, a[n - i]);
}
scanf("%d", &m);
while (m --) {
int opt, x, y;
scanf("%d%d%d", &opt, &x, &y);
x = n - x;
if (opt == 0) {
a[x] += y;
for (int i = 1; i <= bv; ++ i)
sgtChg(br[i][x % i], x / i, y);
}
else {
int ans(a[x]);
if (y <= bv) {
seg *p(br[y][x % y]);
int po(x / y);
while (p-> l + 1 < p-> r)
if (po >= midp(p))
ans = max(ans, p-> ls-> v), p = p-> rs;
else
p = p-> ls;
ans = max(ans, p-> v);
}
else {
for (; x >= 0; x -= y)
ans = max(ans, a[x]);
}
printf("%d\n", ans);
}
}
}