import java.util.*;
import java.lang.*;
import java.io.*;
 
public class Main{
  public static void main (String[] args){
 
	int A,B,C;
//	int[] MAX = new int[3];
//	int max = 0;
 
	Scanner sc = new Scanner (System.in);
		A=sc.nextInt();

/* 
	for(int i = 0; i < MAX.length; i++)
		max = Math.max(max,MAX[i]);
 
		System.out.println(ax);
 
	}
*/
	if(A%10==1){
	  A=A+8;
	}else{
	  A=A-8;
	}
	if((A%100)/10==1){
	  A+=80;
	}else{
	  A-=80;
	}
	if(A/100==1){
	  A+=800;
	}else{
	  A-=800;
	}
  
        System.out.println(A);

  }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz