// parameter "input" gets all data
function Main(input) {
  const stringOfN = input.toString()
  const ArrayOfN = stringOfN.split("")
  let res = ArrayOfN.map(function(char){
    if (char === '1' ) return '9'
    if (char === '9' ) return '1'
  }).toString()
  res = res.replace(/,/gi, "")
	console.log(res);
}
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));