Server Time: Sun Sep 27, 2020 3:53 pm
Welcome ( logout
A - The Vindictive Coach
PDF (English) Ranklist
Time Limit: 2 second(s) Memory Limit: 32 MB

The coach of a football team, after suffering for years the adverse comments of the media about his tactics, decides to take his revenge by presenting his players in a line-up in such a way that the TV cameras would be compelled to zigzag in a ridiculous bobbing motion, by alternating taller and shorter players. However, the team captain objects that he must be the first of the line by protocolary reasons, and that he wants to be seen in the best possible light: that is, he should not have a taller colleague next to him unless there is no alternative (everyone else is taller than him). Even in this case, the height difference should be as small as possible, while maintaining the zigzag arrangement of the line.

With this condition the coach addresses an expert in computation (i.e. you) to help him find the number of different alignments he may make, knowing that all players have a different height. They are always numbered by stature starting by 1 as the shortest one. Of course the number of players may be arbitrary, provided it does not exceed 50.


Input starts with an integer T (≤ 125), denoting the number of test cases.

Each case contains two positive integers N (1 ≤ N ≤ 50) and m (1 ≤ m ≤ N) separated by a blank space. N represents the number of players in the line-up and m is the captain's number, who as told is always the first of the line.


For every case, print the case number and the number of possible alignments under the above conditions. Output the result modulo 264.

Sample Input

Output for Sample Input


3 1

3 3

4 1

7 2

Case 1: 1

Case 2: 1

Case 3: 1

Case 4: 16


Special Thanks: Jane Alam Jan (Dataset, Solution)
Developed and Maintained by
Copyright © 2012
LightOJ, Jane Alam Jan