O=0 for i in range(int(input())): C,D=map(int,input().split()) O+=(C+1)//2*D print(O%(10**9+7))