F

Clicking Checkboxes

Input: Standard Input

Output: Standard Output

 

Creating a good and easy Graphical user interface is the heart of operating a computer in modern days. One important part of this interface is enabling users to give inputs using mouse and keyboard. Many different types of forms are there to take inputs from users. Such as (a) Text Box  (b) Radio Button (c) Check Box (d) Combo Box etc. In this problem we will concentrate on check box.

 

Check boxes are used when a user needs to select more than one choice. Such a checkbox is shown in the figure on the left below.  The problem with checkbox is that when someone has to choose n options or names he has to make n clicks, which can be very annoying when n is high. So the new software giant toggle is using a new type of checkbox, which shows good performance when number of boxes to be checked is high. In normal check box, a box is checked or unchecked if and only if it is clicked but in toggle checkbox when a box is clicked then all the boxes below it is also gets its status. That is if a box is originally not checked then if someone clicks this box then this box and all the boxes below it will be checked. Similarly if a box is checked and someone clicks on it then it will become unchecked and so will all the boxes below it. So the selection made on the left can be made by only five clicks (The boxes that has to be clicked are marked with red or dark square on the right figure) in toggle checkbox (We are calling naming new type of checkbox as “toggle checkbox”).

 



Figure 1: 12 clicks are required in ordinary checkbox

Figure 2: 5 clicks are required in toggle checkbox.

 

The researchers of toggle have shown that toggle checkboxes show better performance when at least 50% boxes are to be checked. For example for the selection shown in the above picture we needed 12 clicks to check 12 boxes in normal checkbox but only five clicks were required for toggle checkboxes. So in this situation toggle boxes show better performance. In many other selection, toggle checkbox would also show strictly better performance. Your job is to count in how many selection patterns (where at least m boxes out of the n boxes in the checkbox are to be selected) toggle check box would show better performance and in how many selection patterns ordinary checkbox would show better performance.

 

Input

The input file contains 1000 lines of inputs. The description of each line is given below:

 

Each line contains two integers n (0<n<64) and m (0mn). These two values indicate that you have to consider a checkbox with n boxes to check and consider only the input patterns where at least m of them are checked. Assume that initially all the boxes are unchecked.                                                                                                                 

Input is terminated by a line containing two zeroes. This line should be processed.                                                                                                                                                                         

Output

For each line of input produce one line of output.

 

This line contains the serial of output followed by two integers TC and NC. Here TC is the total number of selection patterns where toggle checkbox requires less clicks and NC is the total number of selection patterns where ordinary or normal checkboxes require less clicks.

 

Sample Input                               Output for Sample Input

5 3

10 3

0 0

Case 1: 9 3

Case 2: 370 419

 


Problem setter: Shahriar Manzoor, Special Thanks: Derek Kisman, Md. Arifuzzaman Arif

 

Look at the illustration of first sample input on next page

 

 

 

 

 

 

 

 


Illustration of first sample Input/Output:

When the total number of boxes that can be checked is five and at least three boxes has to be selected the total possible patterns for checking is . Of these 16 patterns nine patterns are such that Toggle Checkbox shows better performance, three patterns are such that Normal Checkbox shows better performance while other four others are tied.