import math n = int(input()) sum = 0 for i in range(n): c, d = map(int, input().split()) sum += math.ceil(c/2) * d print(sum)