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