import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String ans = "";
		for(int i = 0; i < n.length(); i++){
			if(n.charAt(i) == '1') ans += "9";
			else if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i);
		}
		
		System.out.println(ans);
	}
} import java.io.File; File java.io import java.io.IOException; IOException java.io import java.util.ArrayDeque; ArrayDeque java.util import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util import java.util.Deque; Deque java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String ans = "";
		for(int i = 0; i < n.length(); i++){
			if(n.charAt(i) == '1') ans += "9";
			else if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i);
		}
		
		System.out.println(ans);
	}
} Main public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String ans = "";
		for(int i = 0; i < n.length(); i++){
			if(n.charAt(i) == '1') ans += "9";
			else if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i);
		}
		
		System.out.println(ans);
	} main {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String ans = "";
		for(int i = 0; i < n.length(); i++){
			if(n.charAt(i) == '1') ans += "9";
			else if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i);
		}
		
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc String ans = ""; ans "" for(int i = 0; i < n.length(); i++){
			if(n.charAt(i) == '1') ans += "9";
			else if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i);
		} int i = 0; int i = 0; i 0 i < n.length() i n.length() n.length n i++ i++ i {
			if(n.charAt(i) == '1') ans += "9";
			else if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i);
		} {
			if(n.charAt(i) == '1') ans += "9";
			else if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i);
		} if(n.charAt(i) == '1') ans += "9";
			else if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i); n.charAt(i) == '1' n.charAt(i) n.charAt n i '1' ans += "9" ans "9" if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i); n.charAt(i) == '9' n.charAt(i) n.charAt n i '9' ans += "1" ans "1" ans += n.charAt(i) ans n.charAt(i) n.charAt n i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String ans = "";
		for(int i = 0; i < n.length(); i++){
			if(n.charAt(i) == '1') ans += "9";
			else if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i);
		}
		
		System.out.println(ans);
	}
} public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String ans = "";
		for(int i = 0; i < n.length(); i++){
			if(n.charAt(i) == '1') ans += "9";
			else if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i);
		}
		
		System.out.println(ans);
	}
} Main
import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String ans = "";
		for(int i = 0; i < n.length(); i++){
			if(n.charAt(i) == '1') ans += "9";
			else if(n.charAt(i) == '9') ans += "1";
			else ans += n.charAt(i);
		}
		
		System.out.println(ans);
	}
}