

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			String n = sc.next();

			n = n.replace('9', '*');
			n = n.replace('1', '9');
			n = n.replace('*', '1');
			System.out.println(n);
		}
	} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			String n = sc.next();

			n = n.replace('9', '*');
			n = n.replace('1', '9');
			n = n.replace('*', '1');
			System.out.println(n);
		}
	} Main public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			String n = sc.next();

			n = n.replace('9', '*');
			n = n.replace('1', '9');
			n = n.replace('*', '1');
			System.out.println(n);
		} main {

			Scanner sc = new Scanner(System.in);
			String n = sc.next();

			n = n.replace('9', '*');
			n = n.replace('1', '9');
			n = n.replace('*', '1');
			System.out.println(n);
		} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc n = n.replace('9', '*') n n.replace('9', '*') n.replace n '9' '*' n = n.replace('1', '9') n n.replace('1', '9') n.replace n '1' '9' n = n.replace('*', '1') n n.replace('*', '1') n.replace n '*' '1' System.out.println(n) System.out.println System.out System System.out n String[] args args public class Main {

	public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			String n = sc.next();

			n = n.replace('9', '*');
			n = n.replace('1', '9');
			n = n.replace('*', '1');
			System.out.println(n);
		}
	} public class Main {

	public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			String n = sc.next();

			n = n.replace('9', '*');
			n = n.replace('1', '9');
			n = n.replace('*', '1');
			System.out.println(n);
		}
	} Main


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			String n = sc.next();

			n = n.replace('9', '*');
			n = n.replace('1', '9');
			n = n.replace('*', '1');
			System.out.println(n);
		}
	}