import java.util.*;
class Main{
static int N = 10, row, col, totalCnt, pathCnt;
static int[][] a = new int[N][N];
static int[][] dir = new int[][]{
{-2, 1}, {-1, 2}, {1, 2}, {2, 1},
{2, -1}, {1, -2}, {-1, -2}, {-2, -1}};
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t -- >0){
row = sc.nextInt(); col = sc.nextInt();
int x = sc.nextInt(), y = sc.nextInt();
totalCnt = row * col;
pathCnt = 0;
boolean[][] st = new boolean[row][col];
st[x][y] = true;
dfs(x, y, st, 1);
System.out.println(pathCnt);
}
}
public static void dfs(int x, int y, boolean[][] st, int pot){
if(pot == totalCnt){
pathCnt++;
return;
}
for(int i = 0; i < 8; i++){
int nx = x + dir[i][0];
int ny = y + dir[i][1];
if(nx < 0 || nx >= row || ny < 0 || ny >= col) continue;
if(st[nx][ny]) continue;
st[nx][ny] = true;
dfs(nx, ny, st, pot + 1);
st[nx][ny] = false;
}
}
}