import java.io.*; import java.util.*; import java.math.*; class Main { public static void out (Object o) { System.out.println(o); } public static BigDecimal cut (BigDecimal b) { String str = b.toString(); int len = str.length(); return len <= 10 ? b : new BigDecimal(str.substring(len - 10,len)); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); BigDecimal ans = BigDecimal.ZERO; BigDecimal two = BigDecimal.valueOf(2); BigDecimal m = BigDecimal.valueOf(1000000007); for (int i = 0; i < n; i++) { String[] line = br.readLine().split(" "); int len = line[1].length(); line[1] = len > 10 ? line[1].substring(len - 10 , len) : line[1]; BigDecimal c = cut(new BigDecimal(line[0]).divide(two).setScale(0 , RoundingMode.CEILING)); BigDecimal d = new BigDecimal(line[1]); ans = ans.add(c.multiply(d)).remainder(m); } out(ans); } }