mod = 10 ** 9 + 7 N, *CD = map(int, open(0).read().split()) ans = 0 for c, d in zip(*[iter(CD)] * 2): ans += -(-c // 2) * d ans %= mod print(ans)