function Main(input){
	var sum = '';
 	for(i = 0; i < input.length; i++){
    	if(input[i] == '1'){
        	sum = sum+'9';
        }else if(input[i] == '9'){
            sum = sum+'1';
        }
    }
  　parseInt(sum,10);
	console.log(sum);
}

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