#include<stdio.h>
#define N 210000
struct node {
int x,next;
__int64 count,vec;
}pre[N];
int n,flag;
int find(int x) {
if(x==n+1)
return n+1;
if(pre[x].count>pre[x].vec) {
int h=pre[x].next;
pre[h].count=pre[h].count+pre[x].count-pre[x].vec;
pre[x].count=pre[x].vec;
pre[x].x=pre[x].next=find(pre[x].next);
}
return pre[x].x;
}
int main() {
__int64 m;
int i,j,k;
while(scanf("%d",&n)!=EOF) {
for(i=1;i<=n;i++) {
pre[i].next=i+1;
pre[i].count=0;
pre[i].x=i;
}
pre[n].x=n;
pre[n].count=0;
for(i=1;i<=n;i++) {
scanf("%I64d",&m);
pre[i].vec=m;
}
scanf("%d",&m);
flag=0;
while(m--) {
scanf("%d",&k);
if(k==1) {
scanf("%d%d",&i,&j);
if(find(i)!=n+1) {
pre[i].count+=j;
find(i);
}
}
else {
scanf("%d",&i);
printf("%I64d\n",pre[i].count);
}
}
}
return 0;
}