N = int(raw_input()) countSum = 0 for i in xrange(N): C,D = map(long,raw_input().split()) countSum += ((C + 1) / 2) * D countSum %= (1000000000L + 7) print countSum