#include using namespace std; using ll = long long; using pint = pair; template class SegmentTree { public: using T = typename M::value_type; private: int m, n; unordered_map data; T modify(int node) { if(data.count(node)) return data[node]; else return (data[node] = M::id()); } T rec(int l, int r, int node, int node_l, int node_r) { if(node_r <= l || node_l >= r)return M::id(); if(node_l >= l && node_r <= r)return modify(node); int mid = (node_l + node_r) / 2; return M::op( rec(l, r, node * 2, node_l, mid), rec(l, r, node * 2 + 1, mid, node_r) ); } public: SegmentTree() = default; SegmentTree(int N) { m = N; for(n = 1; n < N; n <<= 1); } T prod(int l, int r) {return rec(l, r, 1, 0, n);} T get (int i){ return modify(i + n); } T all_prod() {return modify(1);} void set(int index, T val) { index += n; data[index] = val; while(index != 1){ index >>= 1; data[index] = M::op( modify(index<<1), modify((index<<1) + 1)); } } }; template class RSQ { public: using value_type = T; static T op(T l, T r){ return l + r; } static T id(){return 0;} }; int main() { int Q; cin >> Q; SegmentTree> seg(1'000'000'001); ll ans = 0; for(int i = 0; i < Q; i++) { int t, a, b; cin >> t >> a >> b; if(t == 0) seg.set(a, seg.get(a) + b); else { ans += seg.prod(a, b + 1); } } cout << ans << endl; }