import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		String n = "";
		for (int i = 0; i < N.length(); i++) {
			if (String.valueOf(N.charAt(i)).equals("9")) {
				n+="1";
			}else  {
				n+="9";
			}
		}
		System.out.println(n);
		sc.close();
	}
} 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();
		String n = "";
		for (int i = 0; i < N.length(); i++) {
			if (String.valueOf(N.charAt(i)).equals("9")) {
				n+="1";
			}else  {
				n+="9";
			}
		}
		System.out.println(n);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		String n = "";
		for (int i = 0; i < N.length(); i++) {
			if (String.valueOf(N.charAt(i)).equals("9")) {
				n+="1";
			}else  {
				n+="9";
			}
		}
		System.out.println(n);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		String n = "";
		for (int i = 0; i < N.length(); i++) {
			if (String.valueOf(N.charAt(i)).equals("9")) {
				n+="1";
			}else  {
				n+="9";
			}
		}
		System.out.println(n);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String N = sc.next(); N sc.next() sc.next sc String n = ""; n "" for (int i = 0; i < N.length(); i++) {
			if (String.valueOf(N.charAt(i)).equals("9")) {
				n+="1";
			}else  {
				n+="9";
			}
		} int i = 0; int i = 0; i 0 i < N.length() i N.length() N.length N i++ i++ i {
			if (String.valueOf(N.charAt(i)).equals("9")) {
				n+="1";
			}else  {
				n+="9";
			}
		} {
			if (String.valueOf(N.charAt(i)).equals("9")) {
				n+="1";
			}else  {
				n+="9";
			}
		} if (String.valueOf(N.charAt(i)).equals("9")) {
				n+="1";
			}else  {
				n+="9";
			} String.valueOf(N.charAt(i)).equals("9") String.valueOf(N.charAt(i)).equals String.valueOf(N.charAt(i)) String.valueOf String N.charAt(i) N.charAt N i "9" {
				n+="1";
			} n+="1" n "1" {
				n+="9";
			} n+="9" n "9" System.out.println(n) System.out.println System.out System System.out n sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		String n = "";
		for (int i = 0; i < N.length(); i++) {
			if (String.valueOf(N.charAt(i)).equals("9")) {
				n+="1";
			}else  {
				n+="9";
			}
		}
		System.out.println(n);
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		String n = "";
		for (int i = 0; i < N.length(); i++) {
			if (String.valueOf(N.charAt(i)).equals("9")) {
				n+="1";
			}else  {
				n+="9";
			}
		}
		System.out.println(n);
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		String n = "";
		for (int i = 0; i < N.length(); i++) {
			if (String.valueOf(N.charAt(i)).equals("9")) {
				n+="1";
			}else  {
				n+="9";
			}
		}
		System.out.println(n);
		sc.close();
	}
}