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 += Math.ceil((((double) Long.parseLong(data[0]))/2)) * Long.parseLong(data[1]) % (Math.pow(10, 9) + 7); } System.out.println(capacity); } }