'use strict';

function Main(input) {
  const N = input.split("");
  let answer = [];

  for (let val of N) {
    if (val == 1) {
      answer.push(9);
    } else if (val == 9) {
      answer.push(1);
    }
  }

  console.log(answer.join(""))

};

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
