The so-called best problem solver can easily solve this problem, with his/her childhood sweetheart.
It is known that $y = (5+2\sqrt{6})^{1+2^x}$.
For a given integer $x~(0\le x<2^{32})$ and a given prime number $M~(M\le 46337)$, print $[y]\%M$. ($[y]$ means the integer part of $y$)
An integer $T~(1<T\le 1000)$, indicating there are $T$ test cases.
Following are $T$ lines, each containing two integers $x$ and $M$, as introduced above.
The output contains exactly $T$ lines.
Each line contains an integer representing $[y]\%M$.