import math mod = 10 ** 9 + 7 N = input() res = 0 for i in range(N): C,D = map(int, raw_input().split()) res += math.ceil(C / 2.0) * D res %= mod print int(res)