const main = input => {
  const n = input.trim()
  let ans = ''
  for (let i = 0; i < 3; i++) {
    ans += 10 - parseInt(n.substr(i, 1))
  }
  console.log(ans)
}
// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"));
