import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String replace = String.valueOf(n);

		replace = replace.replace("1", "x");
		replace = replace.replace("9", "1");
		replace = replace.replace("x", "9");

		System.out.println(replace);

		sc.close();
	}

} 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();

		String replace = String.valueOf(n);

		replace = replace.replace("1", "x");
		replace = replace.replace("9", "1");
		replace = replace.replace("x", "9");

		System.out.println(replace);

		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String replace = String.valueOf(n);

		replace = replace.replace("1", "x");
		replace = replace.replace("9", "1");
		replace = replace.replace("x", "9");

		System.out.println(replace);

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String replace = String.valueOf(n);

		replace = replace.replace("1", "x");
		replace = replace.replace("9", "1");
		replace = replace.replace("x", "9");

		System.out.println(replace);

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String replace = String.valueOf(n); replace String.valueOf(n) String.valueOf String n replace = replace.replace("1", "x") replace replace.replace("1", "x") replace.replace replace "1" "x" replace = replace.replace("9", "1") replace replace.replace("9", "1") replace.replace replace "9" "1" replace = replace.replace("x", "9") replace replace.replace("x", "9") replace.replace replace "x" "9" System.out.println(replace) System.out.println System.out System System.out replace sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String replace = String.valueOf(n);

		replace = replace.replace("1", "x");
		replace = replace.replace("9", "1");
		replace = replace.replace("x", "9");

		System.out.println(replace);

		sc.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String replace = String.valueOf(n);

		replace = replace.replace("1", "x");
		replace = replace.replace("9", "1");
		replace = replace.replace("x", "9");

		System.out.println(replace);

		sc.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String replace = String.valueOf(n);

		replace = replace.replace("1", "x");
		replace = replace.replace("9", "1");
		replace = replace.replace("x", "9");

		System.out.println(replace);

		sc.close();
	}

}
