n = int(input()) num = 0 for i in range(n): w,score = map(int,input().split()) num = num + w * score print(max(0,num))