Xtreme gcd sum

No attempts yetTime limit4sMemory limit256 MB

Problem

You are given the integer constants a1,b1,,an,bna_1, b_1, \dots, a_n, b_n. Run the code below to the end and find the value that is finally stored in sum.

sum = 0;
for (x1 = a1; x1 <= b1; x1++)
    for (x2 = a2; x2 <= b2; x2++)
        ...
            for (xn = an; xn <= bn; xn++)
                sum = sum + gcd(x1, x2, ..., xn);

gcd returns the greatest common divisor of its arguments x1,x2,,xnx_1, x_2, \dots, x_n, and sum is a variable that holds an arbitrarily large integer.

Looks too easy? I think so too.

Input

The first line contains a natural number nn.

The ii-th of the next nn lines contains aia_i and bib_i, separated by a space.

1n100001 \le n \le 10\,000 and 1aibi10000001 \le a_i \le b_i \le 1\,000\,000.

Output

C and C++ have no data type that holds an arbitrarily large integer, so print the value of sum modulo 10000000071\,000\,000\,007 on one line.