import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.stream.Stream; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); int typeOfDesk = Integer.parseInt(reader.readLine()); long accomodates=0; for (int desk = 0; desk < typeOfDesk; desk++) { String[] inputs = reader.readLine().split(" "); long c = Long.parseLong(inputs[0]); long d = Long.parseLong(inputs[1]); accomodates+=((c + 2 - 1) / 2)*d % (100000007); } System.out.println(accomodates); } }