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