N = int(input()) L = [list(map(int, input().split())) for x in range(N)] s = 0 for n in range(N): if L[n][0] % 2 == 0: s += (L[n][0]*L[n][1]/2) % 1000000007 else: s += ((L[n][0]+1)*L[n][1]/2) % 1000000007 print(int(s) % 1000000007)