#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MP make_pair
#define PB push_back
typedef long long ll;
int N, Q, SZ=600;
ll x[300300], b[600], a[300300];
vector<int> dv[300300];
ll q (int i) {
i--;
return b[i/SZ] + x[i];
}
void m (int i, ll d) {
int p = (i+1)/SZ;
fo(j, 0, p) b[j] += d;
fo(j, p*SZ, i+1) x[j] += d;
}
void u (int l, int r, ll d) {
l--, r--;
if (l) m(l-1, -d);
m(r, d);
}
int main () {
fo(i, 1, 300300) {
for (int j = i; j < 300300; j += i) dv[j].PB(i);
}
scanf("%d", &N);
fo(i, 0, N) scanf("%lld", &a[i]);
scanf("%d", &Q);
while (Q--) {
int t; scanf("%d", &t);
if (t==1) {
int i; scanf("%d", &i);
ll ret = 0;
for (int j : dv[i]) {
ret += q(j);
}
printf("%lld\n", ret + a[i-1]);
} else {
int l, r; ll d; scanf("%d %d %lld", &l, &r, &d);
u(l, r, d);
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgZm8oaSxhLGIpIGZvcihpbnQgaT0oYSk7aTwoYik7aSsrKQojZGVmaW5lIE1PRCAxMDAwMDAwMDA3CiNkZWZpbmUgTVAgbWFrZV9wYWlyCiNkZWZpbmUgUEIgcHVzaF9iYWNrCnR5cGVkZWYgbG9uZyBsb25nIGxsOwoKaW50IE4sIFEsIFNaPTYwMDsKbGwgeFszMDAzMDBdLCBiWzYwMF0sIGFbMzAwMzAwXTsKdmVjdG9yPGludD4gZHZbMzAwMzAwXTsKCmxsIHEgKGludCBpKSB7CglpLS07CglyZXR1cm4gYltpL1NaXSArIHhbaV07Cn0KCnZvaWQgbSAoaW50IGksIGxsIGQpIHsKCWludCBwID0gKGkrMSkvU1o7CglmbyhqLCAwLCBwKSBiW2pdICs9IGQ7CglmbyhqLCBwKlNaLCBpKzEpIHhbal0gKz0gZDs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