Under construction

Still being built. Things may change

Power Levels (Small)

Time limit5sMemory limit512 MB

Summary
For each given digit count D, find the smallest E whose 9000 multifactorial has fewer digits, or output dots when none exists.
Level

Medium4 of 10

Topics
Math, Brute force
Solved
No attempts yet

Problem

A multifactorial is written as an integer NN followed by EE exclamation points, where E≥1E \ge 1. Its value is the product of every N−K×EN - K \times E that is positive, taken over all nonnegative integers KK. Ordinary factorials fit this definition.

5!=5×4×3×2×1=1205! = 5 \times 4 \times 3 \times 2 \times 1 = 120

The other multifactorials of 5 are these.

5!!=5×3×1=155!! = 5 \times 3 \times 1 = 15

5!!!=5×2=105!!! = 5 \times 2 = 10

5!!!!=5×1=55!!!! = 5 \times 1 = 5

Five followed by five or more exclamation points equals 5 every time. A 5 with no exclamation points is not a multifactorial.

The villain Anima and her underling Minera love three things: multifactorials, yelling IT'S OVER 9000 followed by some exclamation points, and roaming the universe looking for someone to fight.

When they meet a possible opponent, Anima asks Minera to measure the opponent's power level with her scanner. A power level is always a positive integer with no leading zero. Today the scanner display is blurry, so Minera can only report the number of digits DD in the power level, not the digits themselves.

Anima wants to yell IT'S OVER followed by a multifactorial of 9000 that describes the opponent's power level accurately. She never says anything that might be false, and she never uses more exclamation points than she needs. Take D=31682D = 31682. Since 9000!9000! also has 31682 digits, the opponent's power level might be at most 9000!9000!, so Anima cannot yell IT'S OVER 9000!. But 9000!!9000!! has fewer than 31682 digits, so the power level is certainly greater than 9000!!9000!! and IT'S OVER 9000!! is always true. The power level also beats 9000!!!9000!!! and 9000!!!!9000!!!!, yet Anima refuses to spend extra exclamation points, so here she yells IT'S OVER 9000!!.

If no multifactorial of 9000 is certainly smaller than the opponent's power level, Anima stays dramatically silent. Silence is written as the ellipsis ....

Work out what Anima yells.

Input

The first line contains the number of test cases TT. Each of the next TT lines contains one integer DD, the number of digits in an opponent's power level.

Limits

  • 1≤T≤1001 \le T \le 100
  • 1≤D≤400001 \le D \le 40000

Output

For each test case, print one line in the form Case #x: y. Here xx is the test case number starting from 1. If Anima must stay silent, yy is .... Otherwise yy is IT'S OVER 9000 followed by the smallest number of exclamation points that works. Use the ASCII apostrophe U+0027.

Hint

For D=1D = 1, every multifactorial of 9000 is at least 9000, so a one digit power level cannot exceed any of them.

The answer for D=19D = 19 carries 1990 exclamation points.

For D=206D = 206, both 9000 with 156 exclamation points and 9000 with 157 exclamation points have 205 digits, while 9000 with 155 exclamation points has 207 digits. Either 156 or 157 gives a true claim, and Anima picks the smaller count.

Examples1

  1. Example 1

    Input
    5
    1
    19
    206
    31682
    31683
    
    Expected output
    Case #1: ...
    Case #2: IT'S OVER 9000!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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