z = 10**9+7 c = 0 for _ in range(int(input())): x, y = map(int, input().split()) c += (x+1)//2 * y print(c % z)