import math n = int(input()) ans = 0 for i in range(n): ss = input().split() c = int(ss[0]) d = int(ss[1]) ans += math.ceil(c / 2) * d print(int(ans % (math.pow(10,7) + 7)))