Mystery Square (Small)

Fill each ? in the binary string with 0 or 1 so the result is a perfect square.

Easy3Brute forceMathNo attempts yetTime limit5sMemory limit512 MB

Problem

I wrote down a large perfect square in binary, then replaced some of its digits with question marks. Work out what my original number was.

Input

The first line of the input gives the number of test cases, TT. The next TT lines each contain one test case: a string SS, a perfect square written in binary with some of its digits replaced by question marks.

Output

For each test case, print one line in the form Case #x: N, where x is the test case number starting from 1 and N is a perfect square written in binary, obtained by replacing each '?' in SS with either '0' or '1'.

Constraints

  • 1T251 \le T \le 25
  • SS begins with '1'.
  • SS contains only the characters '0', '1' and '?'.
  • In every test case there is exactly one possible choice for N.
  • SS is at most 60 characters long.
  • SS contains at most 20 '?' characters.