#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; //#define int long long typedef long long ll; typedef unsigned long long ul; typedef unsigned int ui; const ll mod = 1000000007; const ll INF = mod * mod; typedef pair P; #define stop char nyaa;cin>>nyaa; #define rep(i,n) for(int i=0;i=0;i--) #define Rep(i,sta,n) for(int i=sta;i=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef pair LP; typedef vector vec; typedef long double ld; typedef pair LDP; const ld eps = 1e-5; bool chked[300001]; int leng[300001]; int lengdfs(int n) { if (n == 0)return 0; if (chked[n])return leng[n]; chked[n] = true; int ret = mod; rep1(j, n) { if (j*j > n)break; ret = min(ret, j + lengdfs(n - j * j)); } return leng[n] = ret; } void solve() { int n; cin >> n; int cur = lengdfs(n); string ans; int id = 0; while (n > 0) { bool ansed = false; for (int i = 1; i <= n; i+=2) { if (n - i * i < 0)break; int sum = i + leng[n - i * i]; //cout << cur << " " << sum << endl; if (sum == cur) { rep(j, i) { if (j % 2 == 0)ans.push_back('0'); else ans.push_back('1'); } n -= i * i; cur -= i; ansed = true; break; } } if (!ansed)break; } while (n > 0) { if (id == 0) { for (int i = 2; i <= n; i += 2) { if (n - i * i < 0)break; int sum = i + leng[n - i * i]; if (sum == cur) { rep(j, i) { if (j % 2 == 0)ans.push_back('0'); else ans.push_back('1'); } n -= i * i; cur -= i; break; } } } else { int k = sqrt(n + 1); k = (k / 2) * 2 + 2; for (int i = k; i >=2 ; i -= 2) { if (n - i * i < 0)continue; int sum = i + leng[n - i * i]; if (sum == cur) { rep(j, i) { if (j % 2 == 0)ans.push_back('1'); else ans.push_back('0'); } n -= i * i; cur -= i; break; } } } id ^= 1; } cout << ans << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0); //cout << fixed << setprecision(5); //init(); solve(); //cout << "finish" << endl; //stop return 0; }