#include #include const int MAXN = 112345; long long dp[MAXN]; int main() { for (int i = 0; i < MAXN; ++i) { dp[i] = 1LL << 60; } dp[0] = 0; int N; std::cin >> N; for (int i = 0; i < N; ++i) { for (int j = 1; j*j + i <= N; ++j) { dp[i + j*j] = std::min(dp[i + j*j], dp[i] + j); } } int res = N; int parity = 0; while (res > 0) { bool upd = false; for (int i = parity + 1; i*i <= res; i += 2) { if (dp[res - i*i] + i > dp[res]) continue; for (int j = parity; j < i + parity; ++j) std::cout << j%2; res -= i*i; parity = 0; upd = true; break; } if (upd) continue; for (int i = ((int)std::sqrt(res))/2*2; i >= 1; i -= 2) { for (int j = parity; j < i + parity; ++j) std::cout << j%2; res -= i*i; parity = 1; break; } } std::cout << std::endl; }