object Main{
  def main(args:Array[String]):Unit={
    var input = readLine
    var res = ""
    for(i <- input){
      if(i=='1') res += '9'.toString
      else if(i=='9') res+='1'.toString
      else res+=i.toString
    }
    println(res)
  }
}