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