function Main(input){
  var n = input.split("");
  for(i=0;i<=2;i++){
    if(n[i]=="1"){
      n[i] = 9;
    }else if(n[i]=="9"){
      n[i] = 1;
    }
  } 
  console.log(n.join(""));

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