#include #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() //#pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; templatebool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } templatebool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } //--------------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------------             ∧_∧       ∧_∧  (´<_` )  Welcome to My Coding Space!      ( ´_ゝ`) /  ⌒i @hamayanhamayan     /   \    | |     /   / ̄ ̄ ̄ ̄/  |   __(__ニつ/  _/ .| .|____      \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ int N; int dp[301010]; //--------------------------------------------------------------------------------------------------- void _main() { cin >> N; rep(i, 0, 301010) dp[i] = inf; dp[0] = 0; rep(i, 1, N + 1) rep(x, 1, 10101) { if(i - x * x < 0) break; chmin(dp[i], dp[i - x * x] + x); } vector ord; rep(x, 1, 10101) if(x * x <= N and x % 2 == 1) ord.push_back(x); rrep(x, 10101, 1) if(x * x <= N and x % 2 == 0) ord.push_back(x); string ans = ""; int cu = N; int lst = 0; while(1 <= cu) { fore(x, ord) if(0 <= cu - x * x) if(dp[cu - x * x] + x == dp[cu]) { rep(i, 0, x) { if(0 < i) lst = 1 - lst; ans += char('0' + lst); } cu -= x*x; break; } } cout << ans << endl; }