def desk(n): return int(n/2) + int(n%2) def inputN(): n = input() all = 0 for i in range(int(n)): a,b = input().split(' ') all += desk(int(a)) * int(b) print(all % 1000000000+7) inputN()