function main(input) {
  const S = input.split('');
  S[0] = (S[0] === '9') ? '1' : '9';
  S[1] = (S[1] === '9') ? '1' : '9';
  S[2] = (S[2] === '9') ? '1' : '9';
  let ans = S.join('');
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));