import scala.io.StdIn

object Main {
    def main(args: Array[String]): Unit = {
        val N = StdIn.readLine().split("")
        def modify(stringArray: List[String], string: String = ""): String = {
            stringArray match {
                case Nil => string
                case str :: tail => modify(tail, string + (str match {
                    case "1" => "9"
                    case "9" => "1"
                    case _ => str
                }))
            }
        }

        println(modify(N.toList))
    }
}
