import kotlin.text.*

fun main(args: Array<String>){
    var n = readLine()!!
    var result = StringBuilder()
    for(c in n.indices){
        result.append(when(n.elementAt(c)){
            '1' -> "9"
            else -> "1"
        })
    }
    println(result)
}