import java.util.Scanner;

class Main{
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String string = scanner.next();
		
		String ans = "";
		
		for(int i = 0;i < string.length();i++){
			String aString =  string.substring(i,i+1);
			
			if(aString.equals("1")){
				
				ans = ans+ "9";
				
				
			}else if(aString.equals("9")){
				
				ans = ans + "1";
			}else{
				
				ans = ans + aString;
			}
		}
		
		System.out.println(ans);
		
	}
}
 import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String string = scanner.next();
		
		String ans = "";
		
		for(int i = 0;i < string.length();i++){
			String aString =  string.substring(i,i+1);
			
			if(aString.equals("1")){
				
				ans = ans+ "9";
				
				
			}else if(aString.equals("9")){
				
				ans = ans + "1";
			}else{
				
				ans = ans + aString;
			}
		}
		
		System.out.println(ans);
		
	}
} Main public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String string = scanner.next();
		
		String ans = "";
		
		for(int i = 0;i < string.length();i++){
			String aString =  string.substring(i,i+1);
			
			if(aString.equals("1")){
				
				ans = ans+ "9";
				
				
			}else if(aString.equals("9")){
				
				ans = ans + "1";
			}else{
				
				ans = ans + aString;
			}
		}
		
		System.out.println(ans);
		
	} main {

		Scanner scanner = new Scanner(System.in);
		String string = scanner.next();
		
		String ans = "";
		
		for(int i = 0;i < string.length();i++){
			String aString =  string.substring(i,i+1);
			
			if(aString.equals("1")){
				
				ans = ans+ "9";
				
				
			}else if(aString.equals("9")){
				
				ans = ans + "1";
			}else{
				
				ans = ans + aString;
			}
		}
		
		System.out.println(ans);
		
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String string = scanner.next(); string scanner.next() scanner.next scanner String ans = ""; ans "" for(int i = 0;i < string.length();i++){
			String aString =  string.substring(i,i+1);
			
			if(aString.equals("1")){
				
				ans = ans+ "9";
				
				
			}else if(aString.equals("9")){
				
				ans = ans + "1";
			}else{
				
				ans = ans + aString;
			}
		} int i = 0; int i = 0; i 0 i < string.length() i string.length() string.length string i++ i++ i {
			String aString =  string.substring(i,i+1);
			
			if(aString.equals("1")){
				
				ans = ans+ "9";
				
				
			}else if(aString.equals("9")){
				
				ans = ans + "1";
			}else{
				
				ans = ans + aString;
			}
		} {
			String aString =  string.substring(i,i+1);
			
			if(aString.equals("1")){
				
				ans = ans+ "9";
				
				
			}else if(aString.equals("9")){
				
				ans = ans + "1";
			}else{
				
				ans = ans + aString;
			}
		} String aString =  string.substring(i,i+1); aString string.substring(i,i+1) string.substring string i i+1 i 1 if(aString.equals("1")){
				
				ans = ans+ "9";
				
				
			}else if(aString.equals("9")){
				
				ans = ans + "1";
			}else{
				
				ans = ans + aString;
			} aString.equals("1") aString.equals aString "1" {
				
				ans = ans+ "9";
				
				
			} ans = ans+ "9" ans ans+ "9" ans "9" if(aString.equals("9")){
				
				ans = ans + "1";
			}else{
				
				ans = ans + aString;
			} aString.equals("9") aString.equals aString "9" {
				
				ans = ans + "1";
			} ans = ans + "1" ans ans + "1" ans "1" {
				
				ans = ans + aString;
			} ans = ans + aString ans ans + aString ans aString System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.Scanner;

class Main{
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String string = scanner.next();
		
		String ans = "";
		
		for(int i = 0;i < string.length();i++){
			String aString =  string.substring(i,i+1);
			
			if(aString.equals("1")){
				
				ans = ans+ "9";
				
				
			}else if(aString.equals("9")){
				
				ans = ans + "1";
			}else{
				
				ans = ans + aString;
			}
		}
		
		System.out.println(ans);
		
	}
}

