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