function Main(input) {
  var result = ''
  for (var i = 0; i < 3; i++) {
    if (input[i] === '1') {
      result += '9'
    } else if (input[i] === '9') {
      result += '1'
    } else {
      result += input[i];
    }
  }

  console.log(result);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));