#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 a positive integer T (1T105)T\ (1\le T\le 10^5) representing the number of test cases to solve.

Each of the next TT lines contains two positive integers x,y (1x,y106)x, y\ (1 \le x, y \le 10^6).

Output Format

For each test case, output a non-negative integer representing the answer.

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\}.