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 <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>
#include <bitset>
#include <stack>
 
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
const ll MX = 1e18;
int n;
ll d[64];
 
ll coun(ll l, int k) {
    // k-th bit of [0, l)
    return (1LL<<k) * (l / (1LL<<(k+1))) + max(0LL, (l % (1LL<<(k+1))) - (1LL<<k));
}
 
int check(ll l, ll r) {
    ll d1[150] = {}, d2[150] = {};
    for (int i = 0; i < n; i++) {
        d1[i] = d[i];
        d2[i] = coun(r, i) - coun(l, i);
//        printf("%d %lld %lld\n", i, d1[i], d2[i]);
    }
    ll of = 0;
    for (int i = 0; i < 150; i++) {
        ll nof = (d1[i] + of) / 2;
        d1[i] = (d1[i] + of) % 2;
        of = nof;
    }
    of = 0;
    for (int i = 0; i < 150; i++) {
        ll nof = (d2[i] + of) / 2;
        d2[i] = (d2[i] + of) % 2;
        of = nof;
    }
    assert(!d1[149] and !d2[149]);
    for (int i = 149; i >= 0; i--) {
        if (d1[i] < d2[i]) return 1;
        if (d2[i] < d1[i]) return -1;
    }
    return 0;
}
 
 
int c = 0;
ll a, b;
 
void calc1() {
    b = (1LL<<(n-1)) + d[n-1];
    ll l = 0, r = (1LL<<(n-1));
    while (r-l > 1) {
        ll md = (l+r)/2;
        int f = 0;
        assert(d[n-1] == coun(b, n-1) - coun(md, n-1));
        for (int i = 0; i < n-1; i++) {
            ll x = coun(b, i) - coun(md, i);
            if (x < d[i]) {
                f = -1;
                break;
            }
            if (d[i] < x) {
                f = 1;
                break;
            }
        }
        if (f == 0) {
            a = md; b--;
//            printf("find1: %lld %lld\n", a, b);
            if (b <= MX) c++;
            break;
        }
        if (f == -1) {
            r = md;
        } else {
            l = md;
        }
    }
}
void calc2() {
    ll l = (1LL<<(n-1))-1, r = (1LL<<n)+1 - d[n-1];
    while (r-l > 1) {
        ll md = (l+r)/2;
        assert(d[n-1] == coun(md+d[n-1], n-1) - coun(md, n-1));
        int f = check(md, md+d[n-1]);
        if (f == 0) {
            if (md+d[n-1]-1 <= MX) {
                a = md; b = md+d[n-1]-1;
//                printf("find2: %lld %lld\n", a, b);
                c++;
            }
            break;
        }
        if (f == -1) {
            l = md;
        } else {
            r = md;
        }
    }
}
void solve2() {
    assert(2 <= n and n <= 60);
    if ((1LL<<(n-1)) < d[n-1]) {
        cout << "None" << endl;
        return;
    }
    c = 0;
    calc1();
    calc2();
    if (!c) {
        cout << "None" << endl;
    } else if (2 <= c) {
        cout << "Many" << endl;
    } else {
        cout << a << " " << b << endl;
    }
}
 
bool solve() {
    scanf("%d", &n);
    if (!n) return false;
    fill_n(d, 64, 0);
    bool f = false;
    for (int i = 0; i < n; i++) {
        scanf("%lld", d+i);
        if (MX < d[i]) {
            f = true;
        }
    }
    if (f) {
        cout << "None" << endl;
        return true;
    }
    while (n && !d[n-1]) n--;
    if (n == 0 or 61 <= n) {
//        printf("%d\n", n);
        cout << "None" << endl;
    } else if (n == 1) {
        if (d[0] == 1) {
            cout << "1 1" << endl;
        } else {
            cout << "None" << endl;
        }
    } else {
        solve2();
    }
    return true;
}
 
int main() {
    while (solve()) {}
    return 0;
}