/*
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
int main()
{
string rows[10];
for (int i = 0; i < 10; i++)
{
for (int o = 0; o < 10; o++)
{
int n = i + o;
n = i + o;
while (n > 9)
{
n -= 10;
}
rows[i] += to_string(n);
if (i < 10 / 2)
{
n = o - i;
while (n < 0)
{
n += 10;
}
}
else
{
n = o - i + 1;
while (n < 0)
{
n += 10;
}
}
if (n == 0)
{
rows[i] += "A";
}
else if (n == 1)
{
rows[i] += "B";
}
else if (n == 2)
{
rows[i] += "C";
}
else if (n == 3)
{
rows[i] += "D";
}
else if (n == 4)
{
rows[i] += "E";
}
else if (n == 5)
{
rows[i] += "F";
}
else if (n == 6)
{
rows[i] += "G";
}
else if (n == 7)
{
rows[i] += "H";
}
else if (n == 8)
{
rows[i] += "I";
}
else if (n == 9)
{
rows[i] += "J";
}
if (o != 9)
{
rows[i] += " ";
}
}
std::cout << rows[i] << "\n";
}
ofstream myfile;
myfile.open("Eppapeli.txt");
if (myfile.is_open())
{
for (int i = 0; i < 10; i++)
{
if (i != 10 - 1)
{
myfile << rows[i] + "\n";
}
else
{
myfile << rows[i];
}
}
myfile.close();
}
int a;
std::cin >> a;
return 0;
}*/
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
using namespace std;
int main()
{
const int MAX_CHAR = 64;
const int SEQUENCE_SIZE = 32;
unsigned long long int subCount = 0;
unsigned long long int i = 0;
string bitSeq = "1";
unsigned long long int k = 0;
std::cin >> k;
if (k > 10000)
{
unsigned long long int power = pow(k, k);
cout << power;
}
if (k > 1000)
{
unsigned long long int l = 1;
/*
unsigned long int curK = 1;
unsigned long long int lastAdd1 = 1;
unsigned long long int lastAdd2 = 1;
while (curK < k)
{
l++;
unsigned long long int curAdd = lastAdd1 + lastAdd2;
curK += curAdd;
lastAdd2 = lastAdd1;
lastAdd1 = curAdd;
}
bitSeq = "1";
bitSeq += string(l - 1, '0');*/
while (subCount < k)
{
if (l % 2)
{
bitSeq += '0';
}
else
{
bitSeq += '1';
}
l++;
vector<unsigned long long int>last(MAX_CHAR, -1);
const unsigned long long int n = bitSeq.length();
unsigned long long int* dp = new unsigned long long int[n + 1];
dp[0] = 1;
for (unsigned long long int o = 1; o <= n; o++)
{
dp[o] = 2 * dp[o - 1];
if (last[bitSeq[o - 1]] != (unsigned long long int) - 1)
{
dp[o] = dp[o] - dp[last[bitSeq[o - 1]]];
}
last[bitSeq[o - 1]] = (o - 1);
}
subCount = dp[n] - 1;
}
l = 1;
while (subCount > k)
{
l++;
if (bitSeq[l] == '1')
{
bitSeq[l] = '0';
}
vector<unsigned long long int>last(MAX_CHAR, -1);
const unsigned long long int n = bitSeq.length();
unsigned long long int* dp = new unsigned long long int[n + 1];
dp[0] = 1;
for (unsigned long long int o = 1; o <= n; o++)
{
dp[o] = 2 * dp[o - 1];
if (last[bitSeq[o - 1]] != (unsigned long long int) - 1)
{
dp[o] = dp[o] - dp[last[bitSeq[o - 1]]];
}
last[bitSeq[o - 1]] = (o - 1);
}
subCount = dp[n] - 1;
}
i = stoi(bitSeq, nullptr, 2);
subCount = 0;
}
while (subCount != k)
{
i++;
const string inBits = bitset<SEQUENCE_SIZE>(i).to_string();
bitSeq = inBits.substr(inBits.find("1", 0));
vector<unsigned long long int>last(MAX_CHAR, -1);
const unsigned long long int n = bitSeq.length();
unsigned long long int* dp = new unsigned long long int[n + 1];
dp[0] = 1;
for (unsigned long long int o = 1; o <= n; o++)
{
dp[o] = 2 * dp[o - 1];
if (last[bitSeq[o - 1]] != (unsigned long long int)-1)
{
dp[o] = dp[o] - dp[last[bitSeq[o - 1]]];
}
last[bitSeq[o - 1]] = (o - 1);
}
subCount = dp[n] - 1;
}
std::cout << bitSeq << "\n";
int a = 0;
std::cin >> a;
return 0;
}