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