You are given the integer constants a1,b1,…,an,bn. 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,…,xn, and sum is a variable that holds an arbitrarily large integer.
Looks too easy? I think so too.
The first line contains a natural number n.
The i-th of the next n lines contains ai and bi, separated by a space.
1≤n≤10000 and 1≤ai≤bi≤1000000.
C and C++ have no data type that holds an arbitrarily large integer, so print the value of sum modulo 1000000007 on one line.