var Main = function(Input){
  var Result = '';
  Input.split('').forEach(function(value, index){
    if(value == '1'){
      Result += '9';
    } else if(value == '9'){
      Result += '1';
    } else {
      Result += value;
    }
  });
  console.log(Result);
}

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