use std::{collections::BinaryHeap, cmp::Reverse}; const INF: usize = 1usize << 60; fn priority(val: usize) -> usize { if val % 2 == 1 { val } else { INF - val } } fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let mut dp = vec![INF; n+1]; dp[0] = 0; for i in 1..=n { for j in 1..=i { let val = j * j; if val > i { break; } dp[i] = dp[i].min(dp[i-val] + j); } } let mut result = String::new(); let mut target = n; while target > 0 { let mut pque = BinaryHeap::new(); for i in 1..=target { let val = i * i; if val > target { break; } if dp[target-val] + i == dp[target] { pque.push((Reverse(priority(i)), i)); } } let (_, i) = pque.pop().unwrap(); let val = if i % 2 == 1 { format!("0{}", "10".repeat(i/2)) } else { format!("{}", if result.ends_with('1') { "10".repeat(i/2) } else { "01".repeat(i/2) }) }; result.push_str(&val); target -= i * i; } println!("{}", result); }