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