#include <bits/stdc++.h>
#define N (1<<19)
#define ll long long
#define ld long double
#define M 1000000007
#define INF 0x5ADFACE5
#define LINF 0x51DEEFFEC7C0DECALL
#define pii pair<int, int>
#define pll pair<long long, long long>
#define F first
#define S second
using namespace std;
// testataanpas... hmm...
struct X {
int v[3][3];
};
X I = {{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}};
X A = {{{1, 1, 1}, {1, 0, 0}, {0, 0, 1}}};
X B = {{{2, -1, 0}, {1, 0, 0}, {0, 0, 1}}};
X AI = {{{0, 1, 0}, {1, -1, -1}, {0, 0, 1}}};
X BI = {{{0, 1, 0}, {-1, 2, 0}, {0, 0, 1}}};
inline bool eq (const X a, const X b) {
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
if (a.v[y][x] != b.v[y][x]) return false;
}
}
return true;
}
X mul (const X a, const X b) {
if (eq(b, I)) return a;
if (eq(a, I)) return b;
X c;
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
c.v[y][x] = 0;
for (int z = 0; z < 3; z++) {
c.v[y][x] += a.v[y][z] * b.v[z][x];
}
}
}
return c;
}
X v[(1<<16)];
X inv[(1<<16)];
//vector<int> su[4181];
vector<int> su[6765][4181];
int l[(1<<16)];
int test (const string s) {
int l = s.length();
int dp[l];
int l1 = -1;
int l0 = -1;
for (int j = 0; j < l; j++) {
dp[j] = 0;
if (s[j] == '1') {
if (j) dp[j] = 2 * dp[j - 1];
else dp[j] = 2;
if (l1 != -1) dp[j] -= !l1 ? 1 : dp[l1 - 1];
l1 = j;
} else {
if (j) dp[j] = 2 * dp[j - 1];
else dp[j] = 2;
if (l0 != -1) dp[j] -= !l0 ? 1 : dp[l0 - 1];
l0 = j;
}
}
return dp[l - 1];
}
int main () {
//for (int z = 1000000; z >= 0; z--) {
int k = z;
// cout<<k<<" -> ";
cin>>k;
k++;
v[0] = I;
inv[0] = I;
for (int i = 1; i < (1<<16); i++) {
if (i & 1) v[i] = mul(v[(i - 1) / 2], A);
else v[i] = mul(v[(i - 1) / 2], B);
if (i & 1) inv[i] = mul(AI, inv[(i - 1) / 2]);
else inv[i] = mul(BI, inv[(i - 1) / 2]);
l[i] = l[(i - 1) / 2] + 1;
}
int mx = 0;
int mx2 = 0;
for (int i = 0; i < (1<<16); i++) {
X a = v[i];
mx = max(mx, a.v[0][0] + a.v[0][2]);
mx2 = max(mx2, a.v[1][0] + a.v[1][2]);
su[a.v[0][0] + a.v[0][2]][a.v[1][0] + a.v[1][2]].push_back(i);
}
string sh = "1111111111111111111111111111111111111111111111";
for (int i = 0; i < (1<<16); i++) {
if (l[i] >= sh.length()) break;
X ai = inv[i];
if (ai.v[0][1] == 0) {
int q = (ai.v[0][0] * k + ai.v[0][2]);
int q2 = (ai.v[1][0] * k + ai.v[1][2]);
if (q >= 0 && q <= 6764 && q2 <= 4180 && q2 >= 0) for (int j : su[q][q2]) {
if (l[i] + l[j] >= sh.length()) break;
X p = mul(v[i], v[j]);
if (p.v[0][0] + p.v[0][2] == k) {
int c = 0;
string s = "";
int ic = i;
int jc = j;
for (int k = l[i]; k --> 0;) {
if (i % 2) c = 1 - c;
i = (i - 1) / 2;
s += c ? '1' : '0';
}
string t;
for (int k = l[j]; k --> 0;) {
if (j % 2) c = 1 - c;
j = (j - 1) / 2;
t += c ? '1' : '0';
}
reverse(t.begin(), t.end());
s += t;
if (test(s) == k) {
if (s.length() < sh.length()) sh = s;
}
i = ic;
j = jc;
}
}
} else {
int q = (ai.v[0][0] * k + ai.v[0][2]);
int q2 = (ai.v[1][0] * k + ai.v[1][2]);
int c = q / ai.v[0][1];
while (q - ai.v[0][1] * c <= 6764) {
// 4180 * (a.v[0][0] + a.v[0][2]) + a.v[1][0] + a.v[1][2]
if (q - ai.v[0][1] * c >= 0 && q2 - ai.v[1][1] * c >= 0 && q2 - ai.v[1][1] * c <= 4180) for (int j : su[q - ai.v[0][1] * c][q2 - ai.v[1][1] * c]) {
if (l[i] + l[j] >= sh.length()) break;
X p = mul(v[i], v[j]);
if (p.v[0][0] + p.v[0][2] == k) {
int c = 0;
//cout<<i<<" "<<j<<" "<<c<<" "<<ai.v[0][1]<<endl;
string s = "";
int ic = i;
int jc = j;
for (int k = l[i]; k --> 0;) {
if (i % 2) c = 1 - c;
i = (i - 1) / 2;
s += c ? '1' : '0';
}
string t;
for (int k = l[j]; k --> 0;) {
if (j % 2) c = 1 - c;
j = (j - 1) / 2;
t += c ? '1' : '0';
}
reverse(t.begin(), t.end());
s += t;
if (test(s) == k) {
if (s.length() < sh.length()) sh = s;
}
i = ic;
j = jc;
}
}
if (ai.v[0][1] < 0) c++;
else c--;
}
}
}
cout<<sh<<endl;
//}
}