import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; void main() { auto s = readln.split.map!(to!int); auto n = s[0]; auto dp = new int[](n + 1); auto ans = new bool[][](n + 1); bool[] tmp; dp[] = 1 << 29; dp[0] = 0; foreach (i; 0..n) { for (int j = 1; i + j * j <= n; ++j) { if (dp[i] + j < dp[i + j * j]) { dp[i + j * j] = dp[i] + j; ans[i + j * j] = ans[i]; bool last = i == 0 ? 0 : ans[i].back(); foreach (_; 0..j) ans[i + j * j] ~= last, last ^= 1; } else if (dp[i] + j == dp[i + j * j]) { tmp = ans[i].dup; bool last = i == 0 ? 0 : ans[i].back(); foreach (_; 0..j) tmp ~= last, last ^= 1; ans[i + j * j] = min(ans[i + j * j], tmp); } } } foreach (i; 0..ans[n].length) write(ans[n][i] ? 1 : 0); writeln; }