use std::collections::VecDeque; 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.. { let val = j*j; if val > i { break; } dp[i] = dp[i].min(dp[i-val] + j); } } let mut lengths = vec![]; let mut target = n; while target > 0 { let mut next = 2usize; for i in 1.. { let val = i*i; if val > target { break; } if dp[target] == dp[target-val] + i && priority(next) > priority(i) { next = i; } } lengths.push(next); target -= next*next; } let odds = lengths.iter().filter(|&&v| v % 2 == 1).copied().collect::>(); let mut evens = lengths.iter().filter(|&&v| v % 2 == 0).copied().collect::>(); let mut result = String::new(); for &v in odds.iter() { result.push_str(&format!("0{}", "10".repeat(v/2))); } while !evens.is_empty() { result.push_str(&format!("{}", "01".repeat(evens.pop_front().unwrap()/2))); if !evens.is_empty() { result.push_str(&format!("{}", "10".repeat(evens.pop_back().unwrap()/2))); } } println!("{}", result); }