import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		String str=Integer.toString(n);
		int len=str.length();
		String s="";
		for(int i=0;i<=len-1;i++) {
			if(str.charAt(i)=='1') {
				s+='9';
			}
			else if(str.charAt(i)=='9') {
				s+='1';
			}
	}
		System.out.println(s);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		String str=Integer.toString(n);
		int len=str.length();
		String s="";
		for(int i=0;i<=len-1;i++) {
			if(str.charAt(i)=='1') {
				s+='9';
			}
			else if(str.charAt(i)=='9') {
				s+='1';
			}
	}
		System.out.println(s);
	}
} Main public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		String str=Integer.toString(n);
		int len=str.length();
		String s="";
		for(int i=0;i<=len-1;i++) {
			if(str.charAt(i)=='1') {
				s+='9';
			}
			else if(str.charAt(i)=='9') {
				s+='1';
			}
	}
		System.out.println(s);
	} main {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		String str=Integer.toString(n);
		int len=str.length();
		String s="";
		for(int i=0;i<=len-1;i++) {
			if(str.charAt(i)=='1') {
				s+='9';
			}
			else if(str.charAt(i)=='9') {
				s+='1';
			}
	}
		System.out.println(s);
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int n=scan.nextInt(); n scan.nextInt() scan.nextInt scan String str=Integer.toString(n); str Integer.toString(n) Integer.toString Integer n int len=str.length(); len str.length() str.length str String s=""; s "" for(int i=0;i<=len-1;i++) {
			if(str.charAt(i)=='1') {
				s+='9';
			}
			else if(str.charAt(i)=='9') {
				s+='1';
			}
	} int i=0; int i=0; i 0 i<=len-1 i len-1 len 1 i++ i++ i {
			if(str.charAt(i)=='1') {
				s+='9';
			}
			else if(str.charAt(i)=='9') {
				s+='1';
			}
	} {
			if(str.charAt(i)=='1') {
				s+='9';
			}
			else if(str.charAt(i)=='9') {
				s+='1';
			}
	} if(str.charAt(i)=='1') {
				s+='9';
			}
			else if(str.charAt(i)=='9') {
				s+='1';
			} str.charAt(i)=='1' str.charAt(i) str.charAt str i '1' {
				s+='9';
			} s+='9' s '9' if(str.charAt(i)=='9') {
				s+='1';
			} str.charAt(i)=='9' str.charAt(i) str.charAt str i '9' {
				s+='1';
			} s+='1' s '1' System.out.println(s) System.out.println System.out System System.out s String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		String str=Integer.toString(n);
		int len=str.length();
		String s="";
		for(int i=0;i<=len-1;i++) {
			if(str.charAt(i)=='1') {
				s+='9';
			}
			else if(str.charAt(i)=='9') {
				s+='1';
			}
	}
		System.out.println(s);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		String str=Integer.toString(n);
		int len=str.length();
		String s="";
		for(int i=0;i<=len-1;i++) {
			if(str.charAt(i)=='1') {
				s+='9';
			}
			else if(str.charAt(i)=='9') {
				s+='1';
			}
	}
		System.out.println(s);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		String str=Integer.toString(n);
		int len=str.length();
		String s="";
		for(int i=0;i<=len-1;i++) {
			if(str.charAt(i)=='1') {
				s+='9';
			}
			else if(str.charAt(i)=='9') {
				s+='1';
			}
	}
		System.out.println(s);
	}
}