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