"use strict"
const input = require("fs").readFileSync("/dev/stdin", "utf8")
const n = input.split("")
function main(n){
  	let ans = ""
	for(const n2 of n){
      	switch(n2){
          case "1" :
           	ans+="9"
           break
          case "9" :
          	ans+="1"
          break
          default :
          	ans+=n2
          break
        }
    }
  	return ans
}
        
console.log(main(n));