Factored Aggregates
For this problem, we need to define three functions:
: The total number of factors of
. (
[1, 2, 5, 10])
: The total number of factors of
, which are also divisible by
. (
[2, 10])
: The total number of factors of
, which are also divisible by
, but not divisible by
. (
[2])
In this problem, depending on the type of query, we need you to compute one of the following values:
In type 1:
In type 2:
In type 3:
Since the answer may be large, output your result modulo .
Input
Input will contain two space-separated integers, and
.
Will be the type of query (1, 2, or 3).
Output
Output the value of one of the three values above depending on the value of . Output your result modulo
.
Constraints
- For
of test cases (Batch #1), Only Type 1 Queries will feature.
- For
of test cases (Batch #2), Only Type 2 Queries will feature.
- For
of test cases (Batch #3), Only Type 3 Queries will feature.
Example 1
For input
1 1000
Your program should output 16
, since there are 16 unique factors of 1000 (1, 2, 4, 5, 8, 10, 20, 25, 40, 50, 100, 125, 200, 250, 500, 1000)
Example 2 (Not tested on judge to avoid short-circuiting)
For input
2 1000
Your program should output 100
.
Example 3 (Not tested on judge to avoid short-circuiting)
For input
3 1000
Your program should output 99100
.
Comments