import java.util.Scanner;

class Main{
	static final long MOD = 1000000007;

	static int H, W, K;
	static long[][] dp = new long[110][10];
	static int ans = 0;
	static long n = 0;





	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < 3;i++){
			if(ss.charAt(i) == '1'){
				sb.append("9");
			}else{
				sb.append("1");

			}
		}
		ss = sb.toString();
		System.out.println(ss);

	}
}







	class Pair implements Comparable{
		int from;		//p
		int end;		//y
		int num;
		int bango;
		@Override
		public int compareTo(Object other) {
			Pair otherpair = (Pair)other;

			return end - otherpair.end;
		}
	}
 import java.util.Scanner; Scanner java.util class Main{
	static final long MOD = 1000000007;

	static int H, W, K;
	static long[][] dp = new long[110][10];
	static int ans = 0;
	static long n = 0;





	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < 3;i++){
			if(ss.charAt(i) == '1'){
				sb.append("9");
			}else{
				sb.append("1");

			}
		}
		ss = sb.toString();
		System.out.println(ss);

	}
} Main static final long MOD = 1000000007; MOD 1000000007 static int H H W W K; K static long[][] dp = new long[110][10]; dp new long[110][10] 110 10 static int ans = 0; ans 0 static long n = 0; n 0 public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < 3;i++){
			if(ss.charAt(i) == '1'){
				sb.append("9");
			}else{
				sb.append("1");

			}
		}
		ss = sb.toString();
		System.out.println(ss);

	} main {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < 3;i++){
			if(ss.charAt(i) == '1'){
				sb.append("9");
			}else{
				sb.append("1");

			}
		}
		ss = sb.toString();
		System.out.println(ss);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String ss = sc.next(); ss sc.next() sc.next sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0;i < 3;i++){
			if(ss.charAt(i) == '1'){
				sb.append("9");
			}else{
				sb.append("1");

			}
		} int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
			if(ss.charAt(i) == '1'){
				sb.append("9");
			}else{
				sb.append("1");

			}
		} {
			if(ss.charAt(i) == '1'){
				sb.append("9");
			}else{
				sb.append("1");

			}
		} if(ss.charAt(i) == '1'){
				sb.append("9");
			}else{
				sb.append("1");

			} ss.charAt(i) == '1' ss.charAt(i) ss.charAt ss i '1' {
				sb.append("9");
			} sb.append("9") sb.append sb "9" {
				sb.append("1");

			} sb.append("1") sb.append sb "1" ss = sb.toString() ss sb.toString() sb.toString sb System.out.println(ss) System.out.println System.out System System.out ss String[] args args class Pair implements Comparable{
		int from;		//p
		int end;		//y
		int num;
		int bango;
		@Override
		public int compareTo(Object other) {
			Pair otherpair = (Pair)other;

			return end - otherpair.end;
		}
	} Pair int from;		//p from int end;		//y end int num; num int bango; bango @Override
		public int compareTo(Object other) {
			Pair otherpair = (Pair)other;

			return end - otherpair.end;
		} compareTo {
			Pair otherpair = (Pair)other;

			return end - otherpair.end;
		} Pair otherpair = (Pair)other; otherpair (Pair)other return end - otherpair.end; end - otherpair.end end otherpair.end otherpair otherpair.end Object other other Comparable
import java.util.Scanner;

class Main{
	static final long MOD = 1000000007;

	static int H, W, K;
	static long[][] dp = new long[110][10];
	static int ans = 0;
	static long n = 0;





	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < 3;i++){
			if(ss.charAt(i) == '1'){
				sb.append("9");
			}else{
				sb.append("1");

			}
		}
		ss = sb.toString();
		System.out.println(ss);

	}
}







	class Pair implements Comparable{
		int from;		//p
		int end;		//y
		int num;
		int bango;
		@Override
		public int compareTo(Object other) {
			Pair otherpair = (Pair)other;

			return end - otherpair.end;
		}
	}

