This problem is a programming version of Problem 237 from projecteuler.net
be the number of tours over an
playing board such that:
The following diagram shows one tour over a board:
Define = . It can be shown that and .
Given integers and , what is ?
Since the answer can be quite large, express your solution modulo .
Each test file contains 2 lines. The first line contains and the second .
Print the integer value of your answer modulo .
Sample Input 0
Sample Output 0
It is easily seen that and .
Also, since the case has the following four solutions: