#!/usr/bin/env python2 import sys N = int(input()) num = 0 mod = ((10 ** 9) + 7) for line in sys.stdin: C, D = [int(x) for x in line.split()] num += (C + 1) / 2 * D print(num % mod)