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