Let's start with some notations and definitions. Let m be the fixed positive integer.
- Let a be an integer that coprime to m, that is, gcd(a, m) = 1. The minimal positive integer k such that m divides ak β 1 is called the multiplicative order of a modulo m and denoted as ordm(a). For example, ** ord7(2) = 3** since 23 β 1 = 7 is divisible by 7 but 21 β 1 and 22 β 1 are not. It can be proven that ordm(a) exists for every a that coprime to m.
- Denote by L(m) the maximal possible multiplicative order of some number modulo m. That is, L(m) = max{ordm(a) : 1 β€ a β€ m, gcd(a, m)=1}. For example,
L(5) = max{ ord5(1), ord5(2), ord5(3), ord5(4)} = max{1, 4, 4, 2} = 4
and
L(6) = max{ord6(1), ord6(5)} = max{1, 2} = 2.
- Denote by N(m) the number of positive integers a β€ m such that ** ordm(a) = L(m)**. For example, N(5) = 2, N(6) = 1, N(8) = 3 (numbers that have maximal multiplicative order modulo 8 are 3, 5 and 7).
Now your task is to find for the given positive integers L and R such that L β€ R the product
N(L) β N(L+1) β ... β N(R)
modulo 109 + 7.
Input
The first line contains a positive integer T, the number of test cases. T test cases follow. The only line of each test case contains two space separated positive integers L and R.
Output
For each of the test cases numbered in order from 1 to T, output "Case #i: " followed by the value of required product modulo 109 + 7.
Constraints
1 β€ T β€ 20
1 β€ L β€ R β€ 1012
R β L β€ 500000