3645: Beautiful Array--2018HBCPC I

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:1 解决:1

题目描述

Senior Pan has two positive integers x and y, and she calls an array is a beautiful array if and only if it satisfies the following conditions:

1) The elements in the array are integers.

2) The length of the array is exactly y.

3) The product of each element is exactly x.

Senior Pan wants you to help her calculate the number of beautiful arrays for different x and y.Two arrays A and B are considered different if there exists a position i that Ai≠Bi.

The answer can be very large, so you can just tell her the number mod 10^9+7.

For example, if x is 2 and y is 2, there are four beautiful arrays: [1,2], [2,1], [-1,-2], [-2,-1].

输入

The first line is an integer T, denoting the number of test cases.

For the following T lines, each line contains two positive integers x and y.

1<=T<=10^5, x,y<10^6

输出

Output T lines, each line contains an integer, representing the number of beautiful array mod 10^9+7.

样例输入 复制

2
2 2
4 2

样例输出 复制

4
6

来源/分类