The Banzhaf Buzz-Off#2679

The Banzhaf Buzz-Off

1 second
64 megabytes
Hard

Input

For each test case, the input will consist of two lines. The first line contains two integers and , where is the number of distinct weight values (1 \leq n \leq 60), and is the quota. The second line contains pairs of positive integers w_1\ m_1,\ w_2\ m_2,\ \ldots,\ w_n\ m_n, where w_i is a weight value, and m_i is the number of board members with that weight. The total number of votes V = w_1 m_1 + w_2 m_2 + \ldots + w_n m_n will be in the range 1 \leq V \leq 60. The quota satisfies the condition V/2 < q \leq V, and all weights w_i are distinct, i.e., w_i \ne w_j for i \ne j. A line containing 0 0 signals the end of input.

Output

For each test case, output a single line in the form:

Case : b_1\ b_2\ \ldots\ b_n

where b_i is the Banzhaf Power Index for any member with weight w_i. Separate the Banzhaf Power Indices with a single space.

Examples

Example 1

Loading
Loading