import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); long []C = new long[N]; long []D = new long[N]; for(int i = 0; i < N; i++) { C[i] = scan.nextLong(); D[i] = scan.nextLong(); } scan.close(); long sum = 0; for(int i = 0; i < N; i++) { long k; if(C[i] % 2 == 0) { k = C[i] / 2; }else { k = C[i] / 2 + 1; } sum += k * D[i]; } long ans = sum % (1000000007); System.out.println(ans); } }