res = 0 n = int(input()) for i in range(n): c, d = map(int, input().split()) res += ((c + 1) // 2) * d print(res % (10 ** 9 + 7))