Knights

No attempts yetTime limit60sMemory limit256 MB

Problem

You place knights on a chessboard with MM rows and NN columns. Each square holds at most one knight.

No two knights on the board may attack each other. A knight attacks the square reached by moving two squares in one direction and then one square perpendicular to that direction. In the picture below, the squares attacked by the knight in the center are marked with X.

The squares a knight attacks

Given the size of the board, write a program that counts the ways to place the knights. Placing no knight at all counts as one way.

Input

The first line contains the number of test cases TT. (1T101 \le T \le 10)

Each of the next TT lines contains one test case: two integers MM and NN, separated by a space, giving the size of the board. (1M41 \le M \le 4, 1N1091 \le N \le 10^9)

Output

For each test case, print the number of ways to place the knights modulo 1,000,000,009 on its own line.