from math import ceil v=0 for i in range(int(input())): c,d=list(map(int,input().split(" "))) v+=ceil(c/2)*d v=v%(10**9+7) print(v)