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