import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.next()
    for (i <- n)
      {print(if (i == '1') {"9"} else {"1"})}
    println()
  }
}