use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let mut n: usize = itr.next().unwrap().parse().unwrap(); let mut out = Vec::new(); while n > 0 { write!(out, "{}", n % 7).ok(); n /= 7; } out.reverse(); writeln!(out, "").ok(); stdout().write_all(&out).unwrap(); }