import java.util.*;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = n / 100;
		int b = (n % 100) / 10;
		int c = n % 10;
		if(a == 1) {
			a = 9;
		} else if(a == 9){
			a = 1;
		}
		if(b == 1) {
			b = 9;
		} else if(b == 9){
			b = 1;
		}
		if(c == 1) {
			c = 9;
		} else if(c == 9){
			c = 1;
		}
		
		System.out.println(a * 100 + b * 10 + c);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = n / 100;
		int b = (n % 100) / 10;
		int c = n % 10;
		if(a == 1) {
			a = 9;
		} else if(a == 9){
			a = 1;
		}
		if(b == 1) {
			b = 9;
		} else if(b == 9){
			b = 1;
		}
		if(c == 1) {
			c = 9;
		} else if(c == 9){
			c = 1;
		}
		
		System.out.println(a * 100 + b * 10 + c);
	}
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = n / 100;
		int b = (n % 100) / 10;
		int c = n % 10;
		if(a == 1) {
			a = 9;
		} else if(a == 9){
			a = 1;
		}
		if(b == 1) {
			b = 9;
		} else if(b == 9){
			b = 1;
		}
		if(c == 1) {
			c = 9;
		} else if(c == 9){
			c = 1;
		}
		
		System.out.println(a * 100 + b * 10 + c);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = n / 100;
		int b = (n % 100) / 10;
		int c = n % 10;
		if(a == 1) {
			a = 9;
		} else if(a == 9){
			a = 1;
		}
		if(b == 1) {
			b = 9;
		} else if(b == 9){
			b = 1;
		}
		if(c == 1) {
			c = 9;
		} else if(c == 9){
			c = 1;
		}
		
		System.out.println(a * 100 + b * 10 + c);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int a = n / 100; a n / 100 n 100 int b = (n % 100) / 10; b (n % 100) / 10 (n % 100) n 100 10 int c = n % 10; c n % 10 n 10 if(a == 1) {
			a = 9;
		} else if(a == 9){
			a = 1;
		} a == 1 a 1 {
			a = 9;
		} a = 9 a 9 if(a == 9){
			a = 1;
		} a == 9 a 9 {
			a = 1;
		} a = 1 a 1 if(b == 1) {
			b = 9;
		} else if(b == 9){
			b = 1;
		} b == 1 b 1 {
			b = 9;
		} b = 9 b 9 if(b == 9){
			b = 1;
		} b == 9 b 9 {
			b = 1;
		} b = 1 b 1 if(c == 1) {
			c = 9;
		} else if(c == 9){
			c = 1;
		} c == 1 c 1 {
			c = 9;
		} c = 9 c 9 if(c == 9){
			c = 1;
		} c == 9 c 9 {
			c = 1;
		} c = 1 c 1 System.out.println(a * 100 + b * 10 + c) System.out.println System.out System System.out a * 100 + b * 10 + c a * 100 + b * 10 + c a * 100 a 100 b * 10 b 10 c String args[] args public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = n / 100;
		int b = (n % 100) / 10;
		int c = n % 10;
		if(a == 1) {
			a = 9;
		} else if(a == 9){
			a = 1;
		}
		if(b == 1) {
			b = 9;
		} else if(b == 9){
			b = 1;
		}
		if(c == 1) {
			c = 9;
		} else if(c == 9){
			c = 1;
		}
		
		System.out.println(a * 100 + b * 10 + c);
	}
} public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = n / 100;
		int b = (n % 100) / 10;
		int c = n % 10;
		if(a == 1) {
			a = 9;
		} else if(a == 9){
			a = 1;
		}
		if(b == 1) {
			b = 9;
		} else if(b == 9){
			b = 1;
		}
		if(c == 1) {
			c = 9;
		} else if(c == 9){
			c = 1;
		}
		
		System.out.println(a * 100 + b * 10 + c);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = n / 100;
		int b = (n % 100) / 10;
		int c = n % 10;
		if(a == 1) {
			a = 9;
		} else if(a == 9){
			a = 1;
		}
		if(b == 1) {
			b = 9;
		} else if(b == 9){
			b = 1;
		}
		if(c == 1) {
			c = 9;
		} else if(c == 9){
			c = 1;
		}
		
		System.out.println(a * 100 + b * 10 + c);
	}
}
