#include<iostream> #include<vector> #include<cstdio> #include<algorithm> #include<map> #define INF 0x7f7f7f using namespace std; int n,tree[1000001]={0},a[1000001]={0}; int lowbit(int x){ return (-x)&x; } int add(int ip,int k){ for(int i=ip;i<=n;i+=lowbit(i)) tree[i]+=k; return 0; } int sum(int ip){ int ans=0; for(int i=ip;i>0;i-=lowbit(i)) ans+=tree[i]; return ans; } int main(){ int m; scanf("%d%d",&n,&m); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); add(i,a[i]); } while(m--){ int tp; scanf("%d",&tp); if(tp==1){ int x1,x2; scanf("%d%d",&x1,&x2); add(x1,x2); } else{ int x1,x2; scanf("%d%d",&x1,&x2); printf("%d\n",sum(x2)-sum(x1-1)); } } return 0; }