from math import ceil N = int(input()) t = 0 for _ in range(N): c,d = [int(i) for i in input().split()] t += ceil(c/2) * d print(t%(10**9+7))