n = int(input()) q = [] for i in range(n): q.append(list(map(int ,input().split()))) a = [0] * 1000000000 ans = 0 for i in q: if i[0] == 0: a[i[1]] += i[2] if i[0] == 1: ans += sum(a[i[1]:i[2]+1]) print(ans)