import scala.io.StdIn._
object Main extends App{
  val sc = new java.util.Scanner(System.in)
  val n = sc.next
  for(i <- 0 to 2){
    if(n.charAt(i)=='1'){
     print('9') 
    }
    else{
      print('1')
    }
  }
}