n=int(input()) sum=0 for i in range(n): a,b=map(int,raw_input().split()) sum+=(a+1)/2*b print sum%1000000007