#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=(LL)1<<53;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void print_YES_NO(bool answer){cout<<(answer?"YES":"NO")<<endl;}
void print_Yes_No(bool answer){cout<<(answer?"Yes":"No")<<endl;}
void print_POSSIBLE_IMPOSSIBLE(bool answer){cout<<(answer?"POSSIBLE":"IMPOSSIBLE")<<endl;}

char ca[100];

int main(){
	LL n;
	int i,j,k;
	LL a,b,c;
	LL p,q,r;
	while(cin>>n){
		if(!n)break;
		cin>>ca;
		p=1;
		for(i=0;i<52;i++){
			p<<=1;
			if(ca[i]=='1')p++;
		}
		q=p,r=0;
		while(n){
			if(p==0)break;
			a=(MAX-q-1)/p;
			if(n<=a){
				q+=n*p;
				break;
			}
			n-=a+1;
			q+=p*(a+1);
			q>>=1,p>>=1,r++;
		}
		for(i=11;i>=0;i--){
			if(r%2==0)ca[i]='0';
			else ca[i]='1';
			r/=2;
		}
		for(i=63;i>=12;i--){
			if(q%2==0)ca[i]='0';
			else ca[i]='1';
			q/=2;
		}
		cout<<ca<<endl;
	}
}

