fun main(args: Array<String>) {
    println(readInputLine().toCharArray().map{when (it) {'1' -> '9' '9' -> '1' else -> it}}.joinToString(""))
}

fun readInputLine(): String {
    return readLine()!!
}
