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