One day,Kid is in class.But Kid think what the teacher teaching is so boring,so he decide to play a
game with himself.He will give himself a matrix with n rows and m columns.Then for each
position,Kid will write 0 or 1 on it.Kid want to find that there are how many schemes that for each
row and each column the number of 1 is odd.
The first line is a integer t,the number of case.
Then for each case,there are two numbers,n and m,(1<=n,m<=100)implies the rows and the columns.
For each case,output only one integer,the number of schemes.
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception{
int T;
Scanner in = new Scanner(System.in);
T=in.nextInt();
for(int i=0;i<T;i++){
int n,m;
n=in.nextInt();
m=in.nextInt();
if(n>m){int t=n;n=m;m=t;}
if((n%2==1&&m%2!=1)||(m%2==1&&n%2!=1)){System.out.println("0");continue;}
if(n==1){System.out.println("1");continue;}
int t=(n-1)*(m-1)-1;
BigInteger ans = BigInteger.valueOf(2).shiftLeft(t);
System.out.println(ans);
}
}
}