/* package codechef; // don’t place package name! */
import java.util.;
import java.lang.;
import java.io.*;
/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
long T = Long.parseLong(reader.readLine());
while(T!=0){
long N,M;
String[] input =new String[2];
input = reader.readLine().split(" ");
N = Long.parseLong(input[0]);
M = Long.parseLong(input[1]);
long a = power(2,N);
long b = power(a-1,M);
System.out.println(b%1000000007);
T--;
}
}
catch(Exception e){
e.printStackTrace();
}
}
static long power(long N, long M){
long res = 1;
while (M > 0) {
if ((M & 1)!=0)
res = res * N;
M = M>>1;
N = N*N;
}
return res;
}
}
WHY GETTING “WA” in this answer .