import java.util.Scanner;
 public class Test1009{
   public static void main (String[] args) {
        Scanner in=new Scanner(System.in);
        int number,digit1,digit2,digit3,digit4,newnum;
        number=in.nextInt();
        digit1=number/1000;
        digit2=(number%1000)/100;
        digit3=((number%1000)%100)/10;
        digit4=number%10;
       /*
        * System.out.println("digit1="+digit1+" digit2="+digit2+" digit3="+digit3+" digit4="+digit4);
        */
        digit1=(digit1+9)%10;
        digit2=(digit2+9)%10;
        digit3=(digit3+9)%10;
        digit4=(digit4+9)%10;
        
        int temp;
        temp=digit1;
        digit1=digit3;
        digit3=temp;
        
        temp=digit2;
        digit2=digit4;
        digit4=temp;
        
        newnum=digit1*1000+digit2*100+digit3*10+digit4;
        
        System.out.println("The encrypted number is:"+newnum);
        
    }
}