fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let mut n: usize = n.trim().parse().unwrap(); let org_n: usize = n; let mut result: Vec = vec![]; while n > 0 { result.push(n % 7); n /= 7; } if org_n == 0 { println!("0"); } else { println!("{}", result.iter().rev().map(|i| i.to_string()).collect::>().join("")); } }