n = gets.to_i 99.times do n = n.digits.sum end p n