#P61. [KBC005E] Count 2

[KBC005E] Count 2

Source

This problem is adapted from Long Long OJ, and the copyright belongs to Codeforces.

Problem Source: https://codeforces.com/contest/893/problem/E

Problem Description

There are multiple test cases. For each test case, given xx and yy, find the number of sequences of length yy whose product equals xx.

Negative numbers are allowed in the sequence. Calculate the number of such sequences, modulo 109+710^9+7.

Input Format

This problem contains multiple test cases.

The first line contains an integer TT (1T1051\le T\le 10^5) — the number of test cases to solve.

The next TT lines each contain two integers xix_i and yiy_i (1xi,yi1061\le x_i, y_i\le 10^6). Each line represents a test case.

Output Format

Output TT integers. The ii-th integer should be the number of sequences modulo 109+710^9+7.

Samples

2
6 3
4 2
36
6

Sample Explanation

The possible sequences are as follows:

  • {4,1}\{-4,-1\};
  • {2,2}\{-2,-2\};
  • {1,4}\{-1,-4\};
  • {1,4}\{1,4\};
  • {2,2}\{2,2\};
  • {4,1}\{4,1\}.