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