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