#include using namespace std; using ll = long long; string calc(int num, int bg) { string res = ""; for (int i = 0; i < num; i++) { res += (char)('0' + bg); bg = 1 - bg; } return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector dp(n + 1); //vector dp2(n + 1, 1); for (int i = 0; i <= n; i++) dp[i] = i; //dp2[0] = 0; for (int i = 2; i * i <= n; i++) { for (int j = i * i; j <= n; j++) { int cost = dp[j - i * i] + i; if (dp[j] > cost) { dp[j] = cost; //dp2[j] = i; } } } vector odd; deque even; int cur = n; while (cur > 0) { bool f = false; for (int i = 1; i * i <= cur; i += 2) { if (dp[cur] == dp[cur - i * i] + i) { odd.push_back(i); cur -= i * i; f = true; break; } } if (f) continue; else break; } int hoge = 0; while (cur > 0) { int nex = 0; for (int i = 2; i * i <= cur; i += 2) { if (dp[cur] == dp[cur - i * i] + i) { nex = i; if (hoge == 1) break; } } assert(nex > 0); even.push_back(nex); cur -= nex * nex; } sort(odd.begin(), odd.end()); sort(even.begin(), even.end()); string ans = ""; for (int x : odd) { ans += calc(x, 0); } int bg = 0; while (!even.empty()) { if (bg == 0) { ans += calc(even.back(), bg); even.pop_back(); bg = 1; } else { ans += calc(even.front(), bg); even.pop_front(); bg = 0; } } cout << ans << endl; return 0; }