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