#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

int n;
string b;

int calc(string s) {
  int res = 0;
  for (char c : s) {
    res <<= 1;
    if (c == '1') res++;
  }
  return res;
}

string conv(int n, int sp = 0) {
  string res = "";
  while (n > 0) {
    res = (n & 1 ? "1" : "0") + res;
    n >>= 1;
  }
  while (res.size() < sp) res = "0" + res;
  return res;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  while (cin >> n, n) {
    cin >> b;
    int es = 0;
    string bs = b;
    while (n > 0) {
      string bb = "1" + b;
      bb = bb.substr(0,max(0LL,(int)bb.size()-es));
      int P = calc("1"+bs);
      int Q = calc(bb);
      if (Q == 0) break;
      int k = (POW(53)-P+Q-1)/Q;
      if (n < k) {
        int R = P+Q*n;
        bs = conv(R).substr(1);
        break;
      }
      int R = P+Q*k;
      R >>= 1;
      bs = conv(R).substr(1);
      es++;
      n -= k;
    }
    cout << conv(es,12)+bs << endl;
  }

  return 0;
}
