N = 20 X = [0] * (2**(N+1)-1) def add(j, x): i = 2**N + j - 1 while i >= 0: X[i] += x i = (i-1) // 2 def rangeof(i): s = (len(bin(i+1))-3) l = ((i+1) - (1<= b or r <= a: return 0 if a <= l and r <= b: return X[i] return rangesum(a, b, 2*i+1) + rangesum(a, b, 2*i+2) Q = int(input()) s = 0 for _ in range(Q): t, a, b = map(int, input().split()) if t == 0: add(a, b) else: s += rangesum(a, b+1) print(s)