#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- vector V; int N; int len[303030]; int from[303030]; void solve() { int i,j,k,l,r,x,y; string s; cin>>N; FOR(i,N+1) len[i]=i, from[i]=1; for(i=1;i<=200;i++) { for(j=0;j+i*i<=N;j++) { if(len[j+i*i]>len[j]+i) { len[j+i*i]=len[j]+i; from[j+i*i]=i; } } } multiset V; int cur=N; while(cur) { V.insert(from[cur]); cur-=from[cur]*from[cur]; } string S; int nex=0; while(V.size()) { if(nex==0) { FORR(v,V) { if(v%2==1) { FOR(i,v) S+=(char)('0'+(i%2)); V.erase(V.find(v)); goto out; } } auto v=*V.rbegin(); V.erase(V.find(v)); FOR(i,v) S+=(char)('0'+(i%2)); nex=1; } else { int odd=0; FORR(v,V) { if(v%2==0) { FOR(i,v) S+=(char)('1'-(i%2)); V.erase(V.find(v)); nex=0; goto out; } } auto v=*V.rbegin(); V.erase(V.find(v)); FOR(i,v) S+=(char)('1'-(i%2)); nex=1; } out:; } cout<