fun main() { var n = readLine()!!.toInt() repeat(100){ n = n.toString().sumOf{it-'0'} } println(n) }