Let denote the number of abelian groups of order up to isomorphism. Let and be fixed positive integers. For several pairs of positive integers and such that L \leq R \leq N, find the value of the sum

Let us recall the basic concepts and facts about abelian groups.
An abelian group is a pair G = (A, *), where is a set and is a binary operation on , that is, for any two elements and in , the result a*b is also in . The following properties, called the axioms of an abelian group, must hold:

(i) Associativity: for any , , in , (a*b)*c = a*(b*c).

(ii) There exists in such that for any in , a*e = e*a = a.

(iii) For any in , there exists in such that a*b = b*a = e.

(iv) Commutativity: for any , in , a*b = b*a.

An important example of an abelian group is the cyclic group of order : the set of numbers from to n-1 with the operation of addition modulo . This is denoted as _n.

The direct sum of two abelian groups G = (A, *) and H = (B, \cdot) is the pair G \ H = (C, \times), where C = \{ (a, b) : a \in A,\ b \in B \} and (a_1, b_1) \times (a_2, b_2) = (a_1 * a_2, b_1 \cdot b_2) for all a_1, a_2 \in A and b_1, b_2 \in B.

Two groups G = (A, *) and H = (B, \cdot) are called isomorphic if there is a one-to-one correspondence from to such that f(a_1) \cdot f(a_2) = f(a_1 * a_2) for all a_1, a_2 \in A.
The fundamental theorem of abelian group theory states that any finite abelian group is isomorphic to the direct sum of some cyclic groups.

The Chinese Remainder Theorem states that _{mn} is isomorphic to _m \ _n if and only if and are coprime.
The last two facts make it possible to describe all abelian groups of order up to isomorphism.
For example, if is prime, then all groups of order are isomorphic to _n.
There are non-isomorphic groups of order : _4 and _2 \ _2.
There are non-isomorphic groups of order : _{27}, _9 \ _3 and _3 \ _3 \ _3.
There are non-isomorphic groups of order : _4 \ _9, _2 \ _2 \ _9, _4 \ _3 \ _3 and _2 \ _2 \ _3 \ _3.
The first line of the input file contains positive integers m \leq 10^9, N \leq 200000, and T \leq 10^5 separated by spaces. Each of the next lines contains positive integers , R \leq N separated by a space such that L \leq R.
For each pair of numbers and from the input file, output the value of the corresponding sum on a separate line.
Example 1