#include template class segtree { public: segtree(size_t n): n(n), root(nullptr) {} void set(size_t p, S x) { assert(p < n); root = set(root, 0, n, p, x); } S get(size_t p) { assert(p < n); return get(root, 0, n, p); } S prod(size_t l, size_t r) { assert(l <= r && r <= n); return prod(root, 0, n, l, r); } private: struct node { S value; node *left, *right; node(S value) : value(value), left(nullptr), right(nullptr) {} }; size_t n; node *root; node *set(node *t, size_t a, size_t b, size_t p, S x) { if (!t) t = new node(e()); if (b - a == 1) { t->value = x; return t; } size_t c = (a + b) >> 1; if (p < c) t->left = set(t->left, a, c, p, x); else t->right = set(t->right, c, b, p, x); t->value = op(t->left ? t->left->value : e(), t->right ? t->right->value : e()); return t; } S get(node *t, size_t a, size_t b, size_t p) { if (!t) t = new node(e()); if (b - a == 1) return t->value; size_t c = (a + b) >> 1; if (p < c) return get(t->left, a, c, p); else return get(t->right, c, b, p); } S prod(node *t, size_t a, size_t b, size_t l, size_t r) { if (!t) t = new node(e()); if (b <= l || r <= a) return e(); if (l <= a && b <= r) return t->value; size_t c = (a + b) >> 1; S resl = prod(t->left, a, c, l, r); S resr = prod(t->right, c, b, l, r); return op(resl, resr); } }; using S = int; S op(S a, S b) { return a + b; } S e() { return 0; } int main() { const size_t n = 1000000001; segtree seg(n); size_t q; std::cin >> q; long long ans = 0; while (q--) { int type; std::cin >> type; if (type == 0) { size_t x; int y; std::cin >> x >> y; seg.set(x, seg.get(x) + y); } else { size_t l, r; std::cin >> l >> r; ans += seg.prod(l, r + 1); } } std::cout << ans << '\n'; }