import sys import math as mas n=int(input()) sum=0 for i in range(n): s=input() a,b=map(int,s.split()) sum+=b*((a+1)//2) sum%=1000000007 print(sum) #for i in sys.stdin: # a,b=map(int,i.split()) # print(gcd(a,b),lcm(a,b))