import java.util.Scanner; public class N146 { public static void main(String[] args) { Scanner sca = new Scanner(System.in); int n = sca.nextInt(); long A = 0; long mod = 100000007; for (int i = 0; i < n; i++) { Long C = sca.nextLong(); Long D = sca.nextLong() % mod; A += ((C + 1) / 2) % mod * D; A %= mod; } System.out.println(A); } }