Googol String (Small)

Build the recursive 0/1 string defined by S with a middle 0 plus a switched reversal, then answer the Kth character for each test case.

Easy3RecursionSimulationInterviewNo attempts yetTime limit5sMemory limit512 MB

Problem

A "0/1 string" is a string in which every character is either 0 or 1. Two operations can be applied to a 0/1 string.

  • switch: every 0 becomes 1 and every 1 becomes 0. For example, "100" becomes "011".
  • reverse: the string is reversed. For example, "100" becomes "001".

Consider the infinite sequence of 0/1 strings defined below.

  • S0S_0 = ""
  • S1S_1 = "0"
  • S2S_2 = "001"
  • S3S_3 = "0010011"
  • S4S_4 = "001001100011011"
  • ...
  • SNS_N = SN1S_{N-1} + "0" + switch(reverse(SN1S_{N-1}))

googol is 1010010^{100}. Find the KKth character of SgoogolS_{googol}. Character positions are counted from 1.

Input

The first line contains the number of test cases, TT. Each of the next TT lines contains one integer KK.

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 the KKth character of SgoogolS_{googol}.

Constraints

  • 1T1001 \le T \le 100
  • 1K1051 \le K \le 10^5