n = int(input()) q = [] g = 0 for i in range(n): b = list(map(int ,input().split())) q.append(b) g = max(g,b[2]) a = [0] * g 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)