Under construction

Still being built. Things may change

FreeCell Statistics

Time limit5sMemory limit512 MB

Summary
Decide whether some day total D up to N and overall total G can yield exact win rates PD and PG.
Level

Medium5 of 10

Topics
Number theory, Brute force
Solved
No attempts yet

Problem

I played D games of FreeCell today, where D > 0. Each game of FreeCell ends in one of two ways: I win, or I lose. I have been playing for many years, and I have played G games in total so far, so G ≥ D.

At the end of the day I open the statistics screen to see how well I played. It says that I won exactly PD percent of the D games I played today, and exactly PG percent of the G games I have ever played. Both percentages are exact, with no rounding at all. I do not remember how many games I played today (D), and I do not remember how many games I have played in total (G). All I know is that I could not have played more than N games today, so D ≤ N.

Decide whether the two percentages on the screen are possible, or whether the statistics calculator is broken.

Input

The first line contains the number of test cases, T. Each of the next T lines contains three integers N, PD and PG, separated by spaces.

Limits

  • 1 ≤ T ≤ 100
  • 1 ≤ N ≤ 10
  • 0 ≤ PD ≤ 100
  • 0 ≤ PG ≤ 100

Output

For each test case, print one line in the form Case #x: y, where x is the test case number starting from 1, and y is Possible if both percentages can hold at the same time, or Broken otherwise.

Hint

Take N = 9, PD = 80, PG = 56. If I played 5 games today (D = 5) and 25 games in total (G = 25), then I won 4 games today, which is 80% of 5, and 14 games in total, which is 56% of 25. Both percentages come out exact with no rounding, so this case is possible.

Examples4

  1. Example 1

    Input
    3
    1 100 50
    10 10 100
    9 80 56
    
    Expected output
    Case #1: Possible
    Case #2: Broken
    Case #3: Possible
    
  2. Example 2

    Input
    1
    1 0 0
    
    Expected output
    Case #1: Possible
    
  3. Example 3

    Input
    1
    1 100 100
    
    Expected output
    Case #1: Possible
    
  4. Example 4

    Input
    4
    10 0 100
    10 100 0
    1 50 50
    10 50 50
    
    Expected output
    Case #1: Broken
    Case #2: Broken
    Case #3: Broken
    Case #4: Possible