import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
  	/**
    *
    *
    */
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int inputNum = Integer.parseInt(line);
		int Num_1 = Num_reverse(inputNum - (inputNum/10)*10);
		int Num_10 = Num_reverse(inputNum/10 - (inputNum/100)*10);
		int Num_100 = Num_reverse(inputNum/100);
		
		System.out.println(Num_1 + 10*Num_10 + 100*Num_100);
	}
	public static int Num_reverse(int num) {
		if(num == 1) {
			num = 9;
		} else if (num == 9) {
			num = 1;
		}
		return num;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{
  	/**
    *
    *
    */
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int inputNum = Integer.parseInt(line);
		int Num_1 = Num_reverse(inputNum - (inputNum/10)*10);
		int Num_10 = Num_reverse(inputNum/10 - (inputNum/100)*10);
		int Num_100 = Num_reverse(inputNum/100);
		
		System.out.println(Num_1 + 10*Num_10 + 100*Num_100);
	}
	public static int Num_reverse(int num) {
		if(num == 1) {
			num = 9;
		} else if (num == 9) {
			num = 1;
		}
		return num;
	}
} Main /**
    *
    *
    */
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int inputNum = Integer.parseInt(line);
		int Num_1 = Num_reverse(inputNum - (inputNum/10)*10);
		int Num_10 = Num_reverse(inputNum/10 - (inputNum/100)*10);
		int Num_100 = Num_reverse(inputNum/100);
		
		System.out.println(Num_1 + 10*Num_10 + 100*Num_100);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int inputNum = Integer.parseInt(line);
		int Num_1 = Num_reverse(inputNum - (inputNum/10)*10);
		int Num_10 = Num_reverse(inputNum/10 - (inputNum/100)*10);
		int Num_100 = Num_reverse(inputNum/100);
		
		System.out.println(Num_1 + 10*Num_10 + 100*Num_100);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String line = br.readLine(); line br.readLine() br.readLine br int inputNum = Integer.parseInt(line); inputNum Integer.parseInt(line) Integer.parseInt Integer line int Num_1 = Num_reverse(inputNum - (inputNum/10)*10); Num_1 Num_reverse(inputNum - (inputNum/10)*10) Num_reverse inputNum - (inputNum/10)*10 inputNum (inputNum/10)*10 (inputNum/10) inputNum 10 10 int Num_10 = Num_reverse(inputNum/10 - (inputNum/100)*10); Num_10 Num_reverse(inputNum/10 - (inputNum/100)*10) Num_reverse inputNum/10 - (inputNum/100)*10 inputNum/10 inputNum 10 (inputNum/100)*10 (inputNum/100) inputNum 100 10 int Num_100 = Num_reverse(inputNum/100); Num_100 Num_reverse(inputNum/100) Num_reverse inputNum/100 inputNum 100 System.out.println(Num_1 + 10*Num_10 + 100*Num_100) System.out.println System.out System System.out Num_1 + 10*Num_10 + 100*Num_100 Num_1 + 10*Num_10 + 100*Num_100 Num_1 10*Num_10 10 Num_10 100*Num_100 100 Num_100 String[] args args public static int Num_reverse(int num) {
		if(num == 1) {
			num = 9;
		} else if (num == 9) {
			num = 1;
		}
		return num;
	} Num_reverse {
		if(num == 1) {
			num = 9;
		} else if (num == 9) {
			num = 1;
		}
		return num;
	} if(num == 1) {
			num = 9;
		} else if (num == 9) {
			num = 1;
		} num == 1 num 1 {
			num = 9;
		} num = 9 num 9 if (num == 9) {
			num = 1;
		} num == 9 num 9 {
			num = 1;
		} num = 1 num 1 return num; num int num num public class Main{
  	/**
    *
    *
    */
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int inputNum = Integer.parseInt(line);
		int Num_1 = Num_reverse(inputNum - (inputNum/10)*10);
		int Num_10 = Num_reverse(inputNum/10 - (inputNum/100)*10);
		int Num_100 = Num_reverse(inputNum/100);
		
		System.out.println(Num_1 + 10*Num_10 + 100*Num_100);
	}
	public static int Num_reverse(int num) {
		if(num == 1) {
			num = 9;
		} else if (num == 9) {
			num = 1;
		}
		return num;
	}
} public class Main{
  	/**
    *
    *
    */
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int inputNum = Integer.parseInt(line);
		int Num_1 = Num_reverse(inputNum - (inputNum/10)*10);
		int Num_10 = Num_reverse(inputNum/10 - (inputNum/100)*10);
		int Num_100 = Num_reverse(inputNum/100);
		
		System.out.println(Num_1 + 10*Num_10 + 100*Num_100);
	}
	public static int Num_reverse(int num) {
		if(num == 1) {
			num = 9;
		} else if (num == 9) {
			num = 1;
		}
		return num;
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
  	/**
    *
    *
    */
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int inputNum = Integer.parseInt(line);
		int Num_1 = Num_reverse(inputNum - (inputNum/10)*10);
		int Num_10 = Num_reverse(inputNum/10 - (inputNum/100)*10);
		int Num_100 = Num_reverse(inputNum/100);
		
		System.out.println(Num_1 + 10*Num_10 + 100*Num_100);
	}
	public static int Num_reverse(int num) {
		if(num == 1) {
			num = 9;
		} else if (num == 9) {
			num = 1;
		}
		return num;
	}
}