#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    for(;;){
        ll n;
        cin>>n;
        if(!n) return 0;
        int e=0;
        ll m=1;
        rep(i,0,52){
            char c;
            cin>>c;
            m=2*m+(c-'0');
        }
        ll res=m;
        while(n&&res>=(1LL<<e)){
            if(n>=((1LL<<53)-res+(m>>e)-1)/(m>>e)){
                n-=((1LL<<53)-res+(m>>e)-1)/(m>>e);
                res+=((1LL<<53)-res+(m>>e)-1)/(m>>e)*(m>>e);
                e++;
                res>>=1;
            }
            else{
                res+=(m>>e)*n;
                n=0;
            }
        }
        rer(i,12,0){
            cout << (1LL&e>>i?1:0);
        }
        rer(i,52,0){
            cout << (1LL&res>>i?1:0);
        }
        cout <<"\n";
    }
}
