# yukicoder No.146 試験監督(1) N = int(input()) student = 0 for _ in range(N): C, D = map(int, input().split()) student += ((C + 1) // 2) * D print(student % (10 ** 9 + 7))