import java.io.BufferedReader; import java.io.InputStreamReader; import java.math.BigInteger; public class Main { public static void main(String[] args) { BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); try { int count = Integer.parseInt(read.readLine()); BigInteger ans = new BigInteger("0"); while (count-- > 0) { String[] box = read.readLine().split(" "); int add = 0; if ((Long.parseLong(box[0]) % 2) == 1) { add = 1; } BigInteger fir = new BigInteger("" + ((Long.parseLong(box[0]) / 2) + add)); ans = ans.add(fir.multiply(new BigInteger(Long.parseLong(box[1]) + ""))); ans = ans.mod(new BigInteger("1000000007")); } System.out.println(ans.toString()); } catch (Exception e) { e.printStackTrace(); } } }