import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn="";
		for(int i = 0;i < 3;i++) {
			if(n.charAt(i) == '1') rn += "9";
			else rn += "1";
		}
		System.out.println(Integer.valueOf(rn));
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn="";
		for(int i = 0;i < 3;i++) {
			if(n.charAt(i) == '1') rn += "9";
			else rn += "1";
		}
		System.out.println(Integer.valueOf(rn));
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn="";
		for(int i = 0;i < 3;i++) {
			if(n.charAt(i) == '1') rn += "9";
			else rn += "1";
		}
		System.out.println(Integer.valueOf(rn));
	} main {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn="";
		for(int i = 0;i < 3;i++) {
			if(n.charAt(i) == '1') rn += "9";
			else rn += "1";
		}
		System.out.println(Integer.valueOf(rn));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = String.valueOf(sc.nextInt()); n String.valueOf(sc.nextInt()) String.valueOf String sc.nextInt() sc.nextInt sc String rn=""; rn "" for(int i = 0;i < 3;i++) {
			if(n.charAt(i) == '1') rn += "9";
			else rn += "1";
		} int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
			if(n.charAt(i) == '1') rn += "9";
			else rn += "1";
		} {
			if(n.charAt(i) == '1') rn += "9";
			else rn += "1";
		} if(n.charAt(i) == '1') rn += "9";
			else rn += "1"; n.charAt(i) == '1' n.charAt(i) n.charAt n i '1' rn += "9" rn "9" rn += "1" rn "1" System.out.println(Integer.valueOf(rn)) System.out.println System.out System System.out Integer.valueOf(rn) Integer.valueOf Integer rn String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn="";
		for(int i = 0;i < 3;i++) {
			if(n.charAt(i) == '1') rn += "9";
			else rn += "1";
		}
		System.out.println(Integer.valueOf(rn));
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn="";
		for(int i = 0;i < 3;i++) {
			if(n.charAt(i) == '1') rn += "9";
			else rn += "1";
		}
		System.out.println(Integer.valueOf(rn));
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn="";
		for(int i = 0;i < 3;i++) {
			if(n.charAt(i) == '1') rn += "9";
			else rn += "1";
		}
		System.out.println(Integer.valueOf(rn));
	}
}