Problem: Problem Statement

Let b_i(x) be the i-th least significant bit of x, i.e. the i-th least significant digit of x in base 2 (i \geq 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 A and B be integers that satisfy 1 \leq A \leq B \leq 10^{18}, and k_i be the number of integers x such that A \leq x \leq B and b_i(x) = 1.

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



Input

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


n
k_1
k_2
...
k_n


The first line of each dataset contains an integer n (1 \leq n \leq 64). Then n lines follow, each of which contains k_i (0 \leq k_i \leq 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 A and B can be uniquely determined, output A and B. Separate the numbers by a single space.
* If there exists more than one possible pair of A and B, output `Many` (without quotes).
* Otherwise, i.e. if there exists no possible pair, output `None` (without quotes).

Example

Input

3
2
2
1
49
95351238128934
95351238128934
95351238128932
95351238128936
95351238128936
95351238128936
95351238128960
95351238128900
95351238128896
95351238129096
95351238128772
95351238129096
95351238129096
95351238126156
95351238131712
95351238131712
95351238149576
95351238093388
95351238084040
95351237962316
95351238295552
95351237911684
95351237911684
95351235149824
95351233717380
95351249496652
95351249496652
95351226761216
95351226761216
95351082722436
95351082722436
95352054803020
95352156464260
95348273971200
95348273971200
95354202286668
95356451431556
95356451431556
95346024826312
95356451431556
95356451431556
94557999988736
94256939803780
94256939803780
102741546035788
87649443431880
87649443431880
140737488355328
32684288648324
64
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
11
0
0
1
1
1
0
1
1
1
1
1
63
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
4
1
1
1
1
0


Output

1 4
123456789101112 314159265358979
None
2012 2012
None
Many

Solution (in CPP):

Solution:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

constexpr unsigned long long int ov = 2000000000000000000;

inline pair<unsigned long long int, unsigned long long int>div(unsigned long long int a, unsigned long long int b, unsigned long long int d) {
	if (b == 0) {
		return { 0,0 };
	}
	if (a >= d) {
		auto p = div(a%d, b, d);
		if (a / d <= ov / b) {
			p.first += a / d * b;
		}
		else {
			p.first = ov + 1;
		}
		if (p.first > ov) {
			p.first = ov + 1;
		}
		return p;
	}
	if (b % 2 == 0) {
		auto p = div(a * 2 % d, b / 2, d);
		if (a * 2 >= d) {
			p.first += b / 2;
		}
		if (p.first > ov) {
			p.first = ov + 1;
		}
		return p;
	}
	else {
		auto p = div(a * 2 % d, b / 2, d);
		if (a * 2 >= d)p.first += b / 2;
		p.first += a / d;
		p.second += a % d;
		if (p.second >= d) {
			p.second -= d;
			p.first++;
		}
		if (p.first > ov) {
			p.first = ov + 1;
		}
		return p;
	}
}

void add(pair<unsigned long long int, unsigned long long int>&a, pair<unsigned long long int, unsigned long long int>b, unsigned long long int &d) {
	a.first += b.first;
	a.second += b.second;
	if (a.second >= d) {
		a.second -= d;
		a.first++;
	}
	if (a.first > ov) {
		a.first = ov + 1;
	}
	return;
}

unsigned long long int bitnum(unsigned long long int r, unsigned long long int b) {
	unsigned long long int ret = 0;
	ret = r / (1LL << (b + 1));
	ret <<= b;
	unsigned long long int m = r % (1LL << (b + 1));
	if (m >= 1LL << b)ret += m - (1LL << b) + 1;
	return ret;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	while (cin >> N, N) {
		vector<unsigned long long int>v(N);
		for (auto &i : v)cin >> i;
		bool none = false;
		for (int i = 60; i < N; i++) {
			if (v[i])none = true;
		}
		if (none) {
			cout << "None\n";
			continue;
		}
		vector<pair<unsigned long long int, unsigned long long int>>ans;
		for (unsigned long long int num = ((v[0] == 0) ? 1 : v[0] * 2 - 1); num <= v[0] * 2 + 1; num++) {
			unsigned long long int d = num;
			if (d % 2 == 0)d >>= 1;
			pair<unsigned long long int, unsigned long long int>box;
			for (int i = 0; i < N; i++) {
				add(box, div(1LL << i, v[i], d), d);
			}
			if (box.second)continue;
			if (box.first > ov)continue;
			unsigned long long int st, ed;
			if (num & 1) {
				st = box.first - num / 2;
				ed = box.first += num / 2;
			}
			else {
				st = (box.first - num + 1) / 2;
				ed = st + num - 1;
			}
			if (st <= 0 || ed > ov / 2)continue;
			vector<unsigned long long int>dnum(N);
			for (int i = 0; i < N; i++) {
				dnum[i] = bitnum(ed, i) - bitnum(st - 1, i);
			}
			if (dnum == v)ans.emplace_back( st,ed );
		}
		if (ans.size() == 0) {
			cout << "None\n";
		}
		else if (ans.size() == 1) {
			cout << ans[0].first << " " << ans[0].second << endl;
		}
		else {
			cout << "Many\n";
		}
	}
}