package net.ipipip0129.yukicoder.no146; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int cnt = Integer.parseInt(scan.nextLine()); long capacity = 0; for (int i = 0; i < cnt; i++) { String[] data = scan.nextLine().split(" "); long c = (Long.parseLong(data[0]) + 1) / 2 % 1000000007L; long d = Long.parseLong(data[1]) % 1000000007L; capacity += c * d; capacity %= 1000000007L; } System.out.println(capacity); } }