#include using namespace std; using ll = long long; //#pragma GCC target("avx2") //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") template struct BIT{ int N; unordered_map data; BIT(int size){ N = size; } void add(int i,T x){ i++; while (i <= N){ if (data.find(i) != data.end()){ data[i] += x; } else{ data[i] = x; } i += i&-i; } } T fold(int l,int r){ T res {}; while (r > 0){ if (data.find(r) != data.end()){ res += data[r]; } r -= r&-r; } while (l > 0){ if (data.find(l) != data.end()){ res -= data[l]; } l -= l&-l; } return res; } }; int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); int N; cin >> N; BIT bit = BIT(1000000001); ll ans = 0; for (int i = 0;i < N;i++){ int op; cin >> op; if (op == 0){ int x,y; cin >> x >> y; bit.add(x,y); } else{ int l,r; cin >> l >> r; ans += bit.fold(l,r+1); } } cout << ans << endl; }