#!/usr/bin/env python3 #fileencoding: utf-8 N = int(input()) count = 0 for i in range(N): C, D = [int(i) for i in input().strip().split(" ")] if C % 2 == 0: count += C//2 * D else: count += (C//2+1) * D print(count % (10**9+7))