We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- All Contests
- ProjectEuler+
- Project Euler #237: Tours on a 4 x n playing board
Project Euler #237: Tours on a 4 x n playing board
Project Euler #237: Tours on a 4 x n playing board
This problem is a programming version of Problem 237 from projecteuler.net
Let be the number of tours over an playing board such that:
- The tour starts in the top left corner;
- The tour consists of moves that are up, down, left, or right one square;
- The tour visits each square exactly once;
- The tour ends in the bottom left corner.
The following diagram shows one tour over a board:
![](https://hrcdn.net/euler-project/project/images/p_237.gif)
Define = . It can be shown that and .
Given integers and , what is ?
Since the answer can be quite large, express your solution modulo .
Input Format
Each test file contains 2 lines. The first line contains and the second .
Constraints
- .
- .
Output Format
Print the integer value of your answer modulo .
Sample Input 0
4
3
Sample Output 0
6
Explanation 0
It is easily seen that and . Also, since the case has the following four solutions:
Thus .