#include using namespace std; struct SegmentTree{ private: int n; vector node; public: SegmentTree(vector v){ int sz=(int)v.size(); n=1; while(n=0;i--)node[i]=node[2*i+1]+node[2*i+2]; } void add(long long k,long long val){ k+=n-1; node[k]+=val; while(k > 0) { k = (k - 1) / 2; node[k] = node[2*k+1] + node[2*k+2]; } } long long getsum(int a, int b, int k=0, int l=0, int r=-1) { if(r < 0) r = n; if(b <= l || r <= a) return 0; if(a <= l && r <= b) return node[k]; long long vl = getsum(a, b, 2*k+1, l, (l+r)/2); long long vr = getsum(a, b, 2*k+2, (l+r)/2, r); return vl + vr; } }; int main() { int n; cin >> n; long long ans=0,w=0; SegmentTree seg(vector(n,w)); for(int i=0;i> q >> s >> t; if(q==0){seg.add(s,t);} else{ans+=seg.getsum(s,t+1);} } cout << ans << endl; }