#include using namespace std; #define rep(i,n) REP(i,0,n) #define REP(i,s,e) for(int i=(s); i<(int)(e); i++) #define repr(i, n) REPR(i, n, 0) #define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--) #define all(r) r.begin(),r.end() #define rall(r) r.rbegin(),r.rend() typedef long long ll; typedef vector vi; typedef vector vl; const ll INF = 1e18; const ll MOD = 1e9 + 7; template T chmax(T& a, const T& b){return a = (a > b ? a : b);} template T chmin(T& a, const T& b){return a = (a < b ? a : b);} // #define DEBUG_MODE #ifdef DEBUG_MODE #define dump(x) cout << #x << " : " << x << " " #define dumpL(x) cout << #x << " : " << x << '\n' #define LINE cout << "line : " << __LINE__ << " " #define LINEL cout << "line : " << __LINE__ << '\n' #define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << " " #define dumpVL(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl #define STOP assert(false) #else #define dump(x) #define dumpL(x) #define LINE #define LINEL #define dumpV(v) #define dumpVL(v) #define STOP assert(false) #endif #define mp make_pair namespace std { template ostream &operator <<(ostream& out, const pair& a) { out << '(' << a.fi << ", " << a.se << ')'; return out; } } vi calc(int n) { vi dp(n+10, 1e9); dp[0] = 0; using P = pair; vector

tmp(dp.size()); rep(i, dp.size()) { for(int j = 1; j*j+i < (int)dp.size(); ++j) { if(dp[i+j*j] >= dp[i] + j) { dp[i+j*j] = dp[i] + j; tmp[i+j*j] = {i, j}; } } } vi ret; int cur = n; while(cur > 0) { ret.emplace_back(tmp[cur].second); cur = tmp[cur].first; } return ret; } int main(){ int n; cin >> n; auto v = calc(n); sort(all(v)); dumpVL(v); string str; while((int)str.size() < v.back()+10) { char c = ('0' + (str.size()%2)); str += c; } string ans; do { string tmp; for(auto&& sz: v) { tmp += str.substr((tmp.empty()||tmp.back() == '0') ? 0 : 1, sz); } if(ans.empty()) ans = tmp; chmin(ans, tmp); }while(next_permutation(all(v))); cout << ans << '\n'; return 0; }