eolymp
bolt
Try our new interface for solving problems
Problems

Little Bishops

Little Bishops

A bishop is a piece used in the game of chess which is played on a board of square grids. A bishop can only move diagonally from its current position and two bishops attack each other if one is on the path of the other. In the following figure, the dark squares represent the reachable locations for bishop \textbf{B1} form its current position. The figure also shows that the bishops \textbf{B1} and \textbf{B2} are in attacking positions whereas \textbf{B1} and \textbf{B3} are not. \textbf{B2} and \textbf{B3} are also in non-attacking positions. \includegraphics{https://static.e-olymp.com/content/7a/7a00ce5d90a850551fb301577d04a9874bf4cc0d.jpg} Now, given two numbers \textbf{n} and \textbf{k}, your job is to determine the number of ways one can put \textbf{k} bishops on an \textbf{n}×\textbf{n} chessboard so that no two of them are in attacking positions. \InputFile The input file may contain multiple test cases. Each test case occupies a single line in the input file and contains two integers \textbf{n} (\textbf{1} ≤ \textbf{n} ≤ \textbf{8}) and \textbf{k} (\textbf{0} ≤ \textbf{k} ≤ \textbf{n^2}). A test case containing two zeros for \textbf{n} and \textbf{k} terminates the input and you won't need to process this particular input. \OutputFile For each test case in the input print a line containing the total number of ways one can put the given number of bishops on a chessboard of the given size so that no two of them are in attacking positions. You may safely assume that this number will be less than \textbf{10^15}.
Time limit 1 second
Memory limit 64 MiB
Input example #1
8 6
4 4
0 0
Output example #1
5599888
260