import sys input = sys.stdin.readline #print = sys.stdout.write class BIT: def __init__(self,N): self.N = N self.data = dict() def add(self,i,x): i += 1 while i <= self.N: if i in self.data: self.data[i] += x else: self.data[i] = x i += i&-i def fold(self,l,r): res = 0 while r > 0: if r in self.data: res += self.data[r] r -= r&-r while l > 0: if l in self.data: res -= self.data[l] l -= l&-l return res bit = BIT(1000000001) Q = int(input()) ans = 0 for _ in range(Q): op,x,y = map(int,input().split()) if op == 0: bit.add(x,y) else: ans += bit.fold(x,y+1) print(ans)