import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); int n = koko.nextInt(); long[] c = new long[n]; long[] d = new long[n]; for (int i = 0; i < n; i++) { c[i] = koko.nextLong(); d[i] = koko.nextLong(); } koko.close(); long total = 0; System.out.println(total % 1000000007); long[] t = new long[n]; for (int i = 0; i < n; i++) { if (c[i] % 2 == 0) { t[i] = c[i] * d[i] / 2; t[i] = t[i] % 1000000007; total = total + t[i]; } else { t[i] = (c[i] + 1) * d[i] / 2; t[i] = t[i] % 1000000007; total = total + t[i]; } } System.out.println(total % 1000000007); } }