import java.util.*;
import java.io.*;

class Main {

	void solve() {

		char[] a = incharar();
		for (int i=0; i<a.length; i++) {
			if (a[i] == '1') a[i] = '9';
			else if (a[i] == '9') a[i] = '1';
		}
		out.println(String.valueOf(a));
		
	}
	
	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);
	
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}
	
	public int inint() {
		return in.nextInt();
	}
	
	public String instr() {
		return in.next();
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}
	
} import java.util.*; util.* java import java.io.*; io.* java class Main {

	void solve() {

		char[] a = incharar();
		for (int i=0; i<a.length; i++) {
			if (a[i] == '1') a[i] = '9';
			else if (a[i] == '9') a[i] = '1';
		}
		out.println(String.valueOf(a));
		
	}
	
	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);
	
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}
	
	public int inint() {
		return in.nextInt();
	}
	
	public String instr() {
		return in.next();
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}
	
} Main public static Scanner in = new Scanner(System.in); in new Scanner(System.in) public static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) void solve() {

		char[] a = incharar();
		for (int i=0; i<a.length; i++) {
			if (a[i] == '1') a[i] = '9';
			else if (a[i] == '9') a[i] = '1';
		}
		out.println(String.valueOf(a));
		
	} solve {

		char[] a = incharar();
		for (int i=0; i<a.length; i++) {
			if (a[i] == '1') a[i] = '9';
			else if (a[i] == '9') a[i] = '1';
		}
		out.println(String.valueOf(a));
		
	} char[] a = incharar(); a incharar() incharar for (int i=0; i<a.length; i++) {
			if (a[i] == '1') a[i] = '9';
			else if (a[i] == '9') a[i] = '1';
		} int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {
			if (a[i] == '1') a[i] = '9';
			else if (a[i] == '9') a[i] = '1';
		} {
			if (a[i] == '1') a[i] = '9';
			else if (a[i] == '9') a[i] = '1';
		} if (a[i] == '1') a[i] = '9';
			else if (a[i] == '9') a[i] = '1'; a[i] == '1' a[i] a i '1' a[i] = '9' a[i] a i '9' if (a[i] == '9') a[i] = '1'; a[i] == '9' a[i] a i '9' a[i] = '1' a[i] a i '1' out.println(String.valueOf(a)) out.println out String.valueOf(a) String.valueOf String a public static void main(String[] args) {
		new Main().solve();
		out.flush();
	} main {
		new Main().solve();
		out.flush();
	} new Main().solve() new Main().solve new Main() out.flush() out.flush out String[] args args public int inint() {
		return in.nextInt();
	} inint {
		return in.nextInt();
	} return in.nextInt(); in.nextInt() in.nextInt in public String instr() {
		return in.next();
	} instr {
		return in.next();
	} return in.next(); in.next() in.next in public char[] incharar() {
		return in.next().toCharArray();
	} incharar {
		return in.next().toCharArray();
	} return in.next().toCharArray(); in.next().toCharArray() in.next().toCharArray in.next() in.next in
import java.util.*;
import java.io.*;

class Main {

	void solve() {

		char[] a = incharar();
		for (int i=0; i<a.length; i++) {
			if (a[i] == '1') a[i] = '9';
			else if (a[i] == '9') a[i] = '1';
		}
		out.println(String.valueOf(a));
		
	}
	
	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);
	
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}
	
	public int inint() {
		return in.nextInt();
	}
	
	public String instr() {
		return in.next();
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}
	
}