n = int(input()) result = 0 for _ in range(n): a, b = map(int, input().split()) result += ((a>>1)+(a&1)) * b print(result)