N = int(input()) ans = 0 for _ in range(N): c, d = map(int, input().split()) ans += (c//2+c%2)*d print(ans)