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)); long typeOfDesk = Long.parseLong(reader.readLine()); long accomodates = 0; for (long desk = 0; desk < typeOfDesk; desk++) { String[] inputs = reader.readLine().split(" "); long c = Long.parseLong(inputs[0]) % (100000007); long d = Long.parseLong(inputs[1]) % (100000007); accomodates += ((c + 2 - 1) / 2) * d % (100000007); } System.out.println(accomodates); } }