object Main extends App {
	val k = scala.io.StdIn.readInt
	
	def test(x: Long): Long = {
		var result = x % 10L
		var y = x / 10L
		while(y != 0L){
			result = result + y % 10L
			y = y / 10L
		}
		return result;
	} 

	val a = test(k)
	var y = k+k

	var temp = test(y)
	var result = a

	while(temp != a){
		if(temp < a) result = temp
		y = y + k
		temp = test(y)
	}

	println(result)

}