Counting 1's#4296

Counting 1's

4 seconds
256 megabytes
Very hard

Let b_i(x) be the -th least significant bit of , i.e. the -th least significant digit of in base (i \ge 1). For example, since 6 = (110)_2, b_1(6) = 0, b_2(6) = 1, b_3(6) = 1, b_4(6) = 0, b_5(6) = 0, and so on.

Let and (1 \le A \le B \le 10^{18}) be integers, and k_i be the number of integers such that A \le x \le B and b_i(x) = 1.

Your task is to write a program that determines and for a given \{k_i\}.

Input

The input consists of multiple datasets. The number of datasets is no more than . Each dataset has the following format:

k_1

k_2

k_n

The first line of each dataset contains an integer (1 \le n \le 64). Then lines follow, each of which contains k_i (0 \le k_i \le 2^{63} - 1). For all i > n, k_i = 0.

The input is terminated by n = 0. Your program must not produce output for it.

Output

For each dataset, print one line.

  • If and can be uniquely determined, output and . Separate the numbers by a single space.

  • If there exists more than one possible pair of and , output "Many" (without quotes).

  • Otherwise, i.e. if there exists no possible pair, output "None" (without quotes).

Examples

Example 1

Loading
Loading