#!/usr/bin/env python3 import math N = int(input()) num = 0 for i in range(N): C, D = [int(x) for x in input().split()] num += (math.ceil(C / 2) * D) num %= 10 ** 9 + 7 print(int(num))