#include using namespace std; using int64 = long long; template< class T > struct BinaryIndexedTree { unordered_map< int, T > data; BinaryIndexedTree() { } T sum(int k) { T ret = 0; for(++k; k > 0; k -= k & -k) { if(data.count(k)) ret += data[k]; } return (ret); } void add(int k, T x) { for(++k; k <= (int) (1e9); k += k & -k) data[k] += x; } }; int main() { int Q; cin >> Q; BinaryIndexedTree< int > bit; int64 add = 0; while(Q--) { int t, x, y; cin >> t >> x >> y; if(t == 0) bit.add(x, y); else add += bit.sum(y) - bit.sum(x - 1); } cout << add << endl; }