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