import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); List input = new ArrayList<>(); while (sc.hasNext()) { input.add(sc.nextLine()); } System.out.println(solve(input)); sc.close(); } public static long solve(List input) { long t = 0; for (int i = 1; i < input.size(); i++) { long s = Long.valueOf(input.get(i).split(" ")[0]); long k = Long.valueOf(input.get(i).split(" ")[1]); if (s % 2 == 0) { t += (s / 2) * k; } else { t += (s + 1) / 2 * k; } t = t % 1000000007; } return t; } }