n = int(raw_input()) cnt = 0 for _ in range(n): c,d = map(int, raw_input().split()) cnt += (c+1)/2 * d print cnt % (10**9 + 7)