public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine());
        int[] a = new int[n];
        int[] o = new int[n];
        int[] bit = new int[n];
        for(int i=0; i<n; i++){
            a[i] = Integer.parseInt(st.nextToken());
            o[i] = a[i];
            update(bit, i+1, 1);
        }
        int m = Integer.parseInt(br.readLine());
        while(m-->0){
            st = new StringTokenizer(br.readLine());
            if(Integer.parseInt(st.nextToken())==1){
                int index = Integer.parseInt(st.nextToken());
                int value = Integer.parseInt(st.nextToken());
                while(value>0){
                    if(a[index-1]==0){
                        int l=1; int r=n;
                        int realIndex = query(bit, index);
                        while(l<r){
                            int mid = (r-l)/2+l;
                            if(query(bit, mid)>realIndex) r=mid; else l=mid+1;
                        }
                        if(query(bit, l)>realIndex){
                            index = l;
                        } else{
                            value = 0;
                        }
                    } else{
                        if(value>=a[index-1]){
                            value -= a[index-1];
                            a[index-1] = 0;
                            update(bit, index, -1);
                        } else{
                            a[index-1] -= value;
                            value = 0;
                        }
                    }
                }
            } else{
                int index = Integer.parseInt(st.nextToken());
                System.out.println(o[index-1]-a[index-1]);
            }
        }
    }