#include using namespace std; typedef long long ll; struct dynamicSegtree{ ll e(){return 0;} ll op(ll a,ll b){return a + b;} struct node { ll value; node* left; node* right; node(ll value): value(value), left(nullptr), right(nullptr){} }; int n; node* root; dynamicSegtree(int sz): n(sz), root(nullptr){} void set(int pos,ll val){func_set(pos,val,root,0,n);} void func_set(int pos,ll val,node* &t,int le,int ri){ if(!t) t = new node(e()); if(ri - le==1){ t->value += val; return; } int mid = (le + ri)/2; if(posleft,le,mid); else func_set(pos,val,t->right,mid,ri); t->value = e(); if(t->left) t->value = op(t->left->value,t->value); if(t->right) t->value = op(t->value,t->right->value); } ll get(int pos){return func_get(pos,root,0,n);} ll func_get(int pos,node* &t,int le,int ri){ if(!t) return e(); if(ri - le==1) return t->value; int mid = (le + ri)/2; if(posleft,0,mid); return func_get(pos,t->right,mid,ri); } ll prod(int le,int ri){return func_prod(le,ri,root,0,n);} ll func_prod(int query_le,int query_ri,node* &t, int le,int ri){ if(!t || ri<=query_le || query_ri<=le) return e(); if(query_le<=le && ri<=query_ri) return t->value; int mid = (le + ri)/2; return op(func_prod(query_le,query_ri,t->left,le,mid),func_prod(query_le,query_ri,t->right,mid,ri)); } }; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int i,q; cin >> q; int n = 1000000001; ll ans = 0; dynamicSegtree seg(n); for(i=0;i> t; if(t==0){ ll x,y; cin >> x >> y; seg.set(x,y); }else{ int l,r; cin >> l >> r; r++; ans += seg.prod(l,r); } } cout << ans << "\n"; }