import java.util.*;

class Main {
	public static void main (String[] args) {
		Scanner in=new Scanner(System.in);
		int a[]=new int [3];
		int n=in.nextInt();
        for(int i=2;i>=0;i--)		{
		    a[i]=n%10;
		    if(a[i]==1)
		        a[i]=9;
		    else if(a[i]==9)
		        a[i]=1;
		    n=(n-(n%10))/10;
		}
		for(int i=0;i<3;i++)
		    System.out.print(a[i]);
	}
} import java.util.*; util.* java class Main {
	public static void main (String[] args) {
		Scanner in=new Scanner(System.in);
		int a[]=new int [3];
		int n=in.nextInt();
        for(int i=2;i>=0;i--)		{
		    a[i]=n%10;
		    if(a[i]==1)
		        a[i]=9;
		    else if(a[i]==9)
		        a[i]=1;
		    n=(n-(n%10))/10;
		}
		for(int i=0;i<3;i++)
		    System.out.print(a[i]);
	}
} Main public static void main (String[] args) {
		Scanner in=new Scanner(System.in);
		int a[]=new int [3];
		int n=in.nextInt();
        for(int i=2;i>=0;i--)		{
		    a[i]=n%10;
		    if(a[i]==1)
		        a[i]=9;
		    else if(a[i]==9)
		        a[i]=1;
		    n=(n-(n%10))/10;
		}
		for(int i=0;i<3;i++)
		    System.out.print(a[i]);
	} main {
		Scanner in=new Scanner(System.in);
		int a[]=new int [3];
		int n=in.nextInt();
        for(int i=2;i>=0;i--)		{
		    a[i]=n%10;
		    if(a[i]==1)
		        a[i]=9;
		    else if(a[i]==9)
		        a[i]=1;
		    n=(n-(n%10))/10;
		}
		for(int i=0;i<3;i++)
		    System.out.print(a[i]);
	} Scanner in=new Scanner(System.in); in new Scanner(System.in) int a[]=new int [3]; a new int [3] 3 int n=in.nextInt(); n in.nextInt() in.nextInt in for(int i=2;i>=0;i--)		{
		    a[i]=n%10;
		    if(a[i]==1)
		        a[i]=9;
		    else if(a[i]==9)
		        a[i]=1;
		    n=(n-(n%10))/10;
		} int i=2; int i=2; i 2 i>=0 i 0 i-- i-- i {
		    a[i]=n%10;
		    if(a[i]==1)
		        a[i]=9;
		    else if(a[i]==9)
		        a[i]=1;
		    n=(n-(n%10))/10;
		} {
		    a[i]=n%10;
		    if(a[i]==1)
		        a[i]=9;
		    else if(a[i]==9)
		        a[i]=1;
		    n=(n-(n%10))/10;
		} a[i]=n%10 a[i] a i n%10 n 10 if(a[i]==1)
		        a[i]=9;
		    else if(a[i]==9)
		        a[i]=1; a[i]==1 a[i] a i 1 a[i]=9 a[i] a i 9 if(a[i]==9)
		        a[i]=1; a[i]==9 a[i] a i 9 a[i]=1 a[i] a i 1 n=(n-(n%10))/10 n (n-(n%10))/10 (n-(n%10)) n (n%10) n 10 10 for(int i=0;i<3;i++)
		    System.out.print(a[i]); int i=0; int i=0; i 0 i<3 i 3 i++ i++ i System.out.print(a[i]); System.out.print(a[i]) System.out.print System.out System System.out a[i] a i String[] args args
import java.util.*;

class Main {
	public static void main (String[] args) {
		Scanner in=new Scanner(System.in);
		int a[]=new int [3];
		int n=in.nextInt();
        for(int i=2;i>=0;i--)		{
		    a[i]=n%10;
		    if(a[i]==1)
		        a[i]=9;
		    else if(a[i]==9)
		        a[i]=1;
		    n=(n-(n%10))/10;
		}
		for(int i=0;i<3;i++)
		    System.out.print(a[i]);
	}
}