#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%MOD;
        }
        x = (x*x)%MOD;
        n >>= 1;
    }
    return ret;
}

string solve(ll n){
    string str;
    cin >> str;

    unsigned ll mbit = 1;
    unsigned ll ebit = 0;

    for(int i = 0; i < 52; i++){
        mbit *= 2;
        if(str[i] == '1'){
            mbit += 1;
        }
    }

    unsigned ll base = (1LL << 53);
    unsigned ll ans = mbit;

    for(int i = 0; i < 53; i++){
        unsigned ll need = base - ans;
        unsigned ll tbit = (mbit >> i);
        unsigned ll addNum = (need + tbit - 1)/tbit;
        if(addNum > n){
            ans += (tbit * n);
            break;
        }else{
            ans += (tbit * addNum);
            ans >>= 1;
            ebit++;
            n -= addNum;
        }
    }

    string eret = "",mret = "";

    for(int i = 0; i < 12; i++){
        if(ebit & 1){
            eret += '1';
            ebit -= 1;
        }else{
            eret += '0';
        }
        ebit >>= 1;
    }

    for(int i = 0; i < 52; i++){
        if(ans & 1){
            mret += '1';
            ans -= 1;
        }else{
            mret += '0';
        }
        ans >>= 1;
    }

    string ret = "";

    for(int i = 11; i >= 0; i--){
        ret += eret[i];
    }
    for(int i = 51; i >= 0; i--){
        ret += mret[i];
    }
    return ret;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    vector<string> ans;

    while(true){
        ll n;
        cin >> n;
        if(n == 0){
            break;
        }
        ans.push_back(solve(n));
    }

    for(auto &x:ans){
        cout << x << endl;
    }

    return 0;
}
