import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) m = map(int,read().split()) CD = zip(m,m) x = sum((c+1)//2 * d for c,d in CD) x %= 10**9 + 7 print(x)