#include using namespace std; typedef long long ll; #define F first #define S second #define pii pair #define eb emplace_back #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep3(i, l, n) for (int i = l; i < (n); ++i) #define sz(v) (int)v.size() #define inf (int)(1e9+7) #define abs(x) (x >= 0 ? x : -(x)) #define ceil(a, b) a / b + !!(a % b) ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; } template T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int n; cin >> n; const int MAX_N = 300001; int dp[MAX_N]; rep(i, MAX_N) dp[i] = inf; dp[0] = 0; dp[1] = 1; int from[MAX_N]; fill_n(from, MAX_N, -1); rep3(i, 2, n + 1) for (int j = 1; j * j <= i; ++j) { if (dp[i] > dp[i - j * j] + j) { dp[i] = dp[i - j * j] + j; from[i] = j * j; } } // rep(i, n + 1) cout << dp[i] << " "; cout << endl; // rep(i, n + 1) cout << from[i] << " "; cout << endl; int now = n; vector v; v.eb(sqrt(from[now])); while (1) { now -= from[now]; if (from[now] == -1) break; v.eb(sqrt(from[now])); } // rep(i, sz(v)) cout << v[i] << " "; cout << endl; string str; rep(i, sz(v)) { int now = (sz(str) ? str.back() - '0' : 0); rep(j, v[i]) { str += '0' + now; now ^= 1; } } cout << str << endl; }