#d1405. 拆拆
拆拆
Number of Factor Sequences
Problem Description
There are multiple test cases.
For each case you are given two numbers and . Count how many integer sequences of length have product equal to , i.e.
Note: two sequences are different if and only if they differ in at least one position with the same index. For example, and are considered different sequences.
The answer may be large, so output it modulo .
For example: given , the number can be written as $(\pm1, \pm6), (\pm2, \pm3), (\pm3, \pm2), (\pm6, \pm1)$ — eight length- sequences — so the answer is .
Input Format
The first line contains an integer , the number of test cases to follow.
Each test case contains two numbers and .
Output Format
For each test case, output one line: the answer.
Sample Input
4
6 2
6 3
6 4
1 4
Sample Output
8
36
128
8
Explanation: for test case 4, it is equivalent to assigning an even number of minus signs to , so the answer is .