n = int(input()) import math r=0 for i in range(n): c1,c2=map(int,input().split()) r+=math.ceil(c1/2)*c2 print(r%(10**9+7))