v,w,n=0,10**9+7,int(input()) for i in range(n): c,d=map(int,input().split()) v+=((c+1)//2)*d print(v%w)