SP11830 DOJ1 - DOJO Corridor I
Description
There's a long rectangular corridor in the hall's dojo, one place is already taken by a magic hanjō (1×1 square). You have to put tatamis (1×2 rectangle) in order to cover exactly the rest of the corridor. Sometimes it's possible, sometimes not!
Input Format
The input begins with the number T of test cases in a single line. In each of the next T lines there are two integers : N, M the size of the corridor, I,J coordinates of the magic hanjō, and K the modulo for the output.
Output Format
For each test case, print the number of possibility to do the job, modulo K.