from collections import defaultdict import sys input = sys.stdin.readline #print = sys.stdout.write class BIT: def __init__(self,N): self.N = N self.data = defaultdict(lambda: 0) def build(self,A): for i in range(1,self.N+1): self.data[i] += A[i-1] if i+(i&-i) <= self.N: self.data[i+(i&-i)] += self.data[i] def add(self,i,x): i += 1 while i <= self.N: self.data[i] += x i += i&-i def fold(self,l,r): res = 0 while r > 0: res += self.data[r] r -= r&-r while l > 0: 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)