#include #define rep(i, n) for (int i = 0; i < (n); i++) #define repr(i, n) for (int i = (n) - 1; i >= 0; i--) #define range(a) a.begin(), a.end() using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); int N; cin >> N; vector> dp(N + 1); auto cmp = [&](vector a, vector b) { int s = 0; int t = 0; for (int x : a) s += x; for (int x : b) t += x; if (s != t) return s < t; int fst = 0; for (int i = 0; i < a.size(); i++) { if (a[i] > b[i]) return (fst ^ (b[i] & 1)) == 0; if (a[i] < b[i]) return (fst ^ (a[i] & 1)) == 1; fst ^= (a[i] & 1) ^ 1; } return false; }; for (int i = 0; i < N; i++) { for (int j = 1; i + j * j <= N; j++) { vector tmp(dp[i]); tmp.push_back(j); if (dp[i + j * j].empty() || cmp(tmp, dp[i + j * j])) { dp[i + j * j] = tmp; } } } string ans; char c = '0'; for (int x : dp[N]) { rep(_, x) { ans += c; c ^= '0' ^ '1'; } c ^= '0' ^ '1'; } cout << ans << endl; }