class DynamicBIT: def __init__(self, MAX=10**9): self.data = dict() self.MAX = MAX def add(self, i, x): i += 1 while i <= self.MAX: if i not in self.data: self.data[i] = 0 self.data[i] += x i += i & -i def acc(self, i): res = 0 while i: if i in self.data: res += self.data[i] i -= i & -i return res def prod(self, l, r): return self.acc(r) - self.acc(l) import sys input = sys.stdin.readline q = int(input()) B = DynamicBIT(10**9+1) ans = 0 for _ in range(q): t, p, x = map(int, input().split()) if t == 0: B.add(p, x) else: ans += B.prod(p, x+1) print(ans)