N = int(input()) MOD = 10**9+7 ans = 0 for _ in range(N): a, b = map(int, input().split()) ans += -(-a//2)*b print(ans%MOD)