import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();

		String str=String.valueOf(n);

		for(int i=0;i<str.length();i++) {
			int x=Character.getNumericValue(str.charAt(i));
			System.out.print((x==1)? "9" : ((x==9)? "1":x));
		}
		System.out.println();
    }
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();

		String str=String.valueOf(n);

		for(int i=0;i<str.length();i++) {
			int x=Character.getNumericValue(str.charAt(i));
			System.out.print((x==1)? "9" : ((x==9)? "1":x));
		}
		System.out.println();
    }
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();

		String str=String.valueOf(n);

		for(int i=0;i<str.length();i++) {
			int x=Character.getNumericValue(str.charAt(i));
			System.out.print((x==1)? "9" : ((x==9)? "1":x));
		}
		System.out.println();
    } main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();

		String str=String.valueOf(n);

		for(int i=0;i<str.length();i++) {
			int x=Character.getNumericValue(str.charAt(i));
			System.out.print((x==1)? "9" : ((x==9)? "1":x));
		}
		System.out.println();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan scan.close() scan.close scan String str=String.valueOf(n); str String.valueOf(n) String.valueOf String n for(int i=0;i<str.length();i++) {
			int x=Character.getNumericValue(str.charAt(i));
			System.out.print((x==1)? "9" : ((x==9)? "1":x));
		} int i=0; int i=0; i 0 i<str.length() i str.length() str.length str i++ i++ i {
			int x=Character.getNumericValue(str.charAt(i));
			System.out.print((x==1)? "9" : ((x==9)? "1":x));
		} {
			int x=Character.getNumericValue(str.charAt(i));
			System.out.print((x==1)? "9" : ((x==9)? "1":x));
		} int x=Character.getNumericValue(str.charAt(i)); x Character.getNumericValue(str.charAt(i)) Character.getNumericValue Character str.charAt(i) str.charAt str i System.out.print((x==1)? "9" : ((x==9)? "1":x)) System.out.print System.out System System.out (x==1)? "9" : ((x==9)? "1":x) (x==1) x 1 "9" ((x==9)? "1":x) (x==9) x 9 "1" x System.out.println() System.out.println System.out System System.out String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();

		String str=String.valueOf(n);

		for(int i=0;i<str.length();i++) {
			int x=Character.getNumericValue(str.charAt(i));
			System.out.print((x==1)? "9" : ((x==9)? "1":x));
		}
		System.out.println();
    }
} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();

		String str=String.valueOf(n);

		for(int i=0;i<str.length();i++) {
			int x=Character.getNumericValue(str.charAt(i));
			System.out.print((x==1)? "9" : ((x==9)? "1":x));
		}
		System.out.println();
    }
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();

		String str=String.valueOf(n);

		for(int i=0;i<str.length();i++) {
			int x=Character.getNumericValue(str.charAt(i));
			System.out.print((x==1)? "9" : ((x==9)? "1":x));
		}
		System.out.println();
    }
}