Queries About Numbers
Etibar loves number theory very much. Now it is time to solve a new kind of problem.
There is given a natural number n. He has to answer q queries of the form t k. Here t is the type of query and k is the natural number.
If t = 1, He must find the number of natural numbers which is divisor of both n and k.
If t = 2, He must find the number of natural numbers which is divisor of n and is divisible by k.
If t = 3, He must find the number of natural numbers which is divisor of n and is not divisible by k.
Etibar can solve all these queries, but you will be hungry for night if this happens, because He will not have free time to do it. Therefore you compromise with him and decided that everyone must do his own job. You must program and our hero must do his own works.
Input
There will be two numbers in the first line: n and q (1 ≤ n ≤ 10^12
, 1 ≤ q ≤ 5 * 10^5
). q lines follow with two numbers each: t and k (1 ≤ t ≤ 3, 1 ≤ k ≤ 10^12
).
Output
For each of the q lines you must output the result for corresponding query in separate line.