#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;
inline long countSub(string str) { // Get amount of subsqs
vector<long> last(256, -1);
long n = str.length();
long *dp = new dt[n + 1];
dp[0] = 1;
for (long i = 1; i <= n; i++) {
dp[i] = 2 * dp[i - 1];
if (last[str[i - 1]] != -1) {
dp[i] = dp[i] - dp[last[str[i - 1]]];
}
last[str[i - 1]] = (i - 1);
}
return dp[n];
}
inline string getBin(long value) { // Get value in bin string
string result;
long lookup[32] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648};
long bits = floor(log2(value)) + 1;
for (long i = 0; i < bits; i++) {
if ((value & lookup[i]) != 0) {
result += '1';
} else {
result += '0';
}
}
return result;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long number;
cin >> number;
long cur = 1;
while ((countSub(getBin(cur)) - 1) != number) {
cur++;
}
cout << getBin(cur);
//while (1);
return 0;
}