fn main() { let mut n = read::(); for _ in 0..100 { let ns = format!("{}", n); n = ns .chars() .map(|x| x.to_digit(10).unwrap() as i64) .sum::(); } println!("{}", n); } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() }