// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
using namespace std;
// namespace mp = boost::multiprecision;
// using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

ll mm=0;
ll kk=0;

bool binary_j(ll mid){
  ll ans=(ll)1<<53;
  ll z=mm+kk*mid;
  if(ans<=z)return true;
  return false;
}

ll binary_search(ll left,ll right){
  ll mid;
  while(left<right){
    mid = (left+right)/2;
    if(binary_j(mid)){
      right = mid;
    }
    else{
      left = mid+1;
    }
  }
  return left;
}



int main(){
  ll n;
  string s;
  while(cin>>n,n!=0){
    cin>>s;
    ll e=0;
    ll m=1;
    for(ll i=0;i<52;i++){
      m<<=1;
      if(s[i]=='1')m++;
    }
    ll k=m;
    for(;k>0&&n>0;){
      ll x=0;
      mm=m;
      kk=k;
      x=binary_search(1,min(n,((ll)1<<54)/k));
      m=m+k*x;
      n-=x;
      if(m>=(ll)1<<53){
        k>>=1;
        m>>=1;
        e++;
      }
      m=m&(((ll)1<<53)-1);
    }
    m=m&(((ll)1<<52)-1);
    e=e&(((ll)1<<12)-1);
    cout<<bitset<12>(e)<<bitset<52>(m)<<endl;
  }
}

