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