#coding=UTF-8 # 1 2 3 4 5 6 # 1 1 2 2 3 3 import math N=int(input()) ans=0 for idx in range(0,N,1): mojir=input() hyo=mojir.split(" ") C=int(hyo[0]) D=int(hyo[1]) ans=(ans+math.ceil(C/2)*D)%(10**9+7) print(ans)