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(" "); capacity += ((Long.parseLong(data[0]) + 1) / 2 % 1000000007) * (Long.parseLong(data[1]) % 1000000007) % 1000000007; } System.out.println(capacity); } }