import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str= sc.next();
		str = str.replaceAll("9", "A");
		str = str.replaceAll("1", "9");
		str = str.replaceAll("A", "1");
		System.out.println(str);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str= sc.next();
		str = str.replaceAll("9", "A");
		str = str.replaceAll("1", "9");
		str = str.replaceAll("A", "1");
		System.out.println(str);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str= sc.next();
		str = str.replaceAll("9", "A");
		str = str.replaceAll("1", "9");
		str = str.replaceAll("A", "1");
		System.out.println(str);
	} main {
		Scanner sc = new Scanner(System.in);
		String str= sc.next();
		str = str.replaceAll("9", "A");
		str = str.replaceAll("1", "9");
		str = str.replaceAll("A", "1");
		System.out.println(str);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str= sc.next(); str sc.next() sc.next sc str = str.replaceAll("9", "A") str str.replaceAll("9", "A") str.replaceAll str "9" "A" str = str.replaceAll("1", "9") str str.replaceAll("1", "9") str.replaceAll str "1" "9" str = str.replaceAll("A", "1") str str.replaceAll("A", "1") str.replaceAll str "A" "1" System.out.println(str) System.out.println System.out System System.out str String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str= sc.next();
		str = str.replaceAll("9", "A");
		str = str.replaceAll("1", "9");
		str = str.replaceAll("A", "1");
		System.out.println(str);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str= sc.next();
		str = str.replaceAll("9", "A");
		str = str.replaceAll("1", "9");
		str = str.replaceAll("A", "1");
		System.out.println(str);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str= sc.next();
		str = str.replaceAll("9", "A");
		str = str.replaceAll("1", "9");
		str = str.replaceAll("A", "1");
		System.out.println(str);
	}
}