import java.util.*;
class Main{
    public static void main(String[] args){
	Scanner stdIn=new Scanner(System.in);
	int n = stdIn.nextInt();
	int j;
	int[] result=new int[3];
	int i=2;
	while(n!=0){
	    j = n%10;
	    if(j==9){
		result[i]=1;
	    }else if(j==1){
		result[i]=9;
	    }else{
		result[i]=j;
	    }
	    n/=10;
	    i--;
	}
	System.out.print(result[0]);
	System.out.print(result[1]);
	System.out.println(result[2]);
    }
}
	 import java.util.*; util.* java class Main{
    public static void main(String[] args){
	Scanner stdIn=new Scanner(System.in);
	int n = stdIn.nextInt();
	int j;
	int[] result=new int[3];
	int i=2;
	while(n!=0){
	    j = n%10;
	    if(j==9){
		result[i]=1;
	    }else if(j==1){
		result[i]=9;
	    }else{
		result[i]=j;
	    }
	    n/=10;
	    i--;
	}
	System.out.print(result[0]);
	System.out.print(result[1]);
	System.out.println(result[2]);
    }
} Main public static void main(String[] args){
	Scanner stdIn=new Scanner(System.in);
	int n = stdIn.nextInt();
	int j;
	int[] result=new int[3];
	int i=2;
	while(n!=0){
	    j = n%10;
	    if(j==9){
		result[i]=1;
	    }else if(j==1){
		result[i]=9;
	    }else{
		result[i]=j;
	    }
	    n/=10;
	    i--;
	}
	System.out.print(result[0]);
	System.out.print(result[1]);
	System.out.println(result[2]);
    } main {
	Scanner stdIn=new Scanner(System.in);
	int n = stdIn.nextInt();
	int j;
	int[] result=new int[3];
	int i=2;
	while(n!=0){
	    j = n%10;
	    if(j==9){
		result[i]=1;
	    }else if(j==1){
		result[i]=9;
	    }else{
		result[i]=j;
	    }
	    n/=10;
	    i--;
	}
	System.out.print(result[0]);
	System.out.print(result[1]);
	System.out.println(result[2]);
    } Scanner stdIn=new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int j; j int[] result=new int[3]; result new int[3] 3 int i=2; i 2 while(n!=0){
	    j = n%10;
	    if(j==9){
		result[i]=1;
	    }else if(j==1){
		result[i]=9;
	    }else{
		result[i]=j;
	    }
	    n/=10;
	    i--;
	} n!=0 n 0 {
	    j = n%10;
	    if(j==9){
		result[i]=1;
	    }else if(j==1){
		result[i]=9;
	    }else{
		result[i]=j;
	    }
	    n/=10;
	    i--;
	} j = n%10 j n%10 n 10 if(j==9){
		result[i]=1;
	    }else if(j==1){
		result[i]=9;
	    }else{
		result[i]=j;
	    } j==9 j 9 {
		result[i]=1;
	    } result[i]=1 result[i] result i 1 if(j==1){
		result[i]=9;
	    }else{
		result[i]=j;
	    } j==1 j 1 {
		result[i]=9;
	    } result[i]=9 result[i] result i 9 {
		result[i]=j;
	    } result[i]=j result[i] result i j n/=10 n 10 i-- i System.out.print(result[0]) System.out.print System.out System System.out result[0] result 0 System.out.print(result[1]) System.out.print System.out System System.out result[1] result 1 System.out.println(result[2]) System.out.println System.out System System.out result[2] result 2 String[] args args
import java.util.*;
class Main{
    public static void main(String[] args){
	Scanner stdIn=new Scanner(System.in);
	int n = stdIn.nextInt();
	int j;
	int[] result=new int[3];
	int i=2;
	while(n!=0){
	    j = n%10;
	    if(j==9){
		result[i]=1;
	    }else if(j==1){
		result[i]=9;
	    }else{
		result[i]=j;
	    }
	    n/=10;
	    i--;
	}
	System.out.print(result[0]);
	System.out.print(result[1]);
	System.out.println(result[2]);
    }
}
	
