function main(input) {
  const S = input.split('');
  for (let i = 0; i < S.length; i++) {
    S[i] === '9' ? S[i] = '1' : S[i] = '9';
  }
  console.log(S.join(''));
}

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