#include using namespace std; template struct DynamicSegmentTree{ using OP = function; U n, sz; unordered_map node; T t; OP op; DynamicSegmentTree(U n, T t, OP op): n(n), t(t), op(op){ sz = 1; while(sz < n) sz <<= 1; } void update(U k, T x){ k += sz; node[k] = x; while(k >>= 1){ T l = node.find(2*k)==node.end() ? t : node[2*k]; T r = node.find(2*k+1)==node.end() ? t : node[2*k+1]; node[k] = op(l, r); } } T query(int a, int b){ T L = t, R = t; for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) { if(a & 1){ T x = node.find(a)==node.end() ? t : node[a]; L = op(L, x); a++; } if(b & 1){ --b; T x = node.find(b)==node.end() ? t : node[b]; R = op(x, R); } } return op(L, R); } }; int main(){ int n = 1000000000, q; cin >> q; DynamicSegmentTree seg(n+1, 0, [](int64_t a, int64_t b){ return a+b; }); int64_t ans = 0; while(q--){ int t; cin >> t; if(!t){ int p, x; cin >> p >> x; auto a = seg.query(p, p+1); seg.update(p, a + x); }else{ int l, r; cin >> l >> r; auto res = seg.query(l, r+1); ans += res; } } cout << ans << endl; }