N = 100000000 class FenwickTree(object): def __init__(self, num_elems): self.num_elems = num_elems self.data = [0 for _ in range(num_elems)] def sum_to(self, end): s = 0 i = end - 1 while i >= 0: s += self.data[i] i = (i & (i + 1)) - 1 return s def sum_range(self, start, end): return self.sum_to(end) - self.sum_to(start) def add(self, idx, x): while idx < self.num_elems: self.data[idx] += x idx |= idx + 1 def main(): ans = 0 n = int(input()) ft = FenwickTree(N) for _ in range(n): q, x, y = (int(z) for z in input().split()) if q == 0: ft.add(x, y) else: ans += ft.sum_range(x, y + 1) print(ans) if __name__ == "__main__": main()