fun main(args:Array<String>?): Unit {
    while(true){
        val n = readLine()!!.trim().toLong()
        if (n == 0L) return
        println(n.toDec())
    }
}
fun Long.toDec(): Long {
    return if (this in 0 until 10) this else ((this % 10 + 10) % 10).let{last -> last + ((this - last) / -10).toDec() * 10}
}
