n = int(input()) c = 0 for _ in range(n): seat, desk = map(int, input().split()) t = (seat + 1) // 2 * desk c += t print(c %(10 ** 9 + 7))