import sys input = sys.stdin.readline #print = sys.stdout.write class SegTree: def __init__(self,N,op,identity): self.op = op self.identity = identity self.N = N self.data = dict() def __getitem__(self,key): key += self.N if key in self.data: return self.data[key] else: return self.identity def set_value(self,x,val): x += self.N self.data[x] = val while x > 1: x >>= 1 if x<<1|0 in self.data: l = self.data[x<<1|0] else: l = self.identity if x<<1|1 in self.data: r = self.data[x<<1|1] else: r = self.identity self.data[x] = self.op(l,r) def fold(self,l,r): res = self.identity l,r = l+self.N,r+self.N while l < r: if l&1: if l in self.data: lv = self.data[l] else: lv = self.identity res = self.op(res,lv) l += 1 if r&1: r -= 1 if r in self.data: rv = self.data[r] else: rv = self.identity res = self.op(res,rv) l,r = l>>1,r>>1 return res seg = SegTree(1000000001,lambda x,y:x+y,0) Q = int(input()) ans = 0 for _ in range(Q): op,x,y = map(int,input().split()) if op == 0: seg.set_value(x,seg[x]+y) else: ans += seg.fold(x,y+1) print(ans)