import math n = int(input()) mod = 10**9+7 ans = 0 for i in range(n): a, b = map(int, input().split()) ans += math.ceil(a/2) * b % mod print(ans)