import java.util.Scanner;

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-a*100)/10;
		int c = N-a*100-b*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.Scanner; Scanner 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-a*100)/10;
		int c = N-a*100-b*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-a*100)/10;
		int c = N-a*100-b*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-a*100)/10;
		int c = N-a*100-b*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-a*100)/10; b (N-a*100)/10 (N-a*100) N a*100 a 100 10 int c = N-a*100-b*10; c N-a*100-b*10 N-a*100-b*10 N a*100 a 100 b*10 b 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-a*100)/10;
		int c = N-a*100-b*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-a*100)/10;
		int c = N-a*100-b*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.Scanner;

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-a*100)/10;
		int c = N-a*100-b*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);
	}
}
