import java.util.*;

public class Main {
	void solve() {
		Scanner scan = new Scanner(System.in);
		String n = scan.next();
		for(int i = 0; i < 3; i++) {
			if(n.charAt(i) == '1') System.out.print(9);
			else if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i));
		}
		scan.close();
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
} import java.util.*; util.* java public class Main {
	void solve() {
		Scanner scan = new Scanner(System.in);
		String n = scan.next();
		for(int i = 0; i < 3; i++) {
			if(n.charAt(i) == '1') System.out.print(9);
			else if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i));
		}
		scan.close();
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
} Main void solve() {
		Scanner scan = new Scanner(System.in);
		String n = scan.next();
		for(int i = 0; i < 3; i++) {
			if(n.charAt(i) == '1') System.out.print(9);
			else if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i));
		}
		scan.close();
	} solve {
		Scanner scan = new Scanner(System.in);
		String n = scan.next();
		for(int i = 0; i < 3; i++) {
			if(n.charAt(i) == '1') System.out.print(9);
			else if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i));
		}
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String n = scan.next(); n scan.next() scan.next scan for(int i = 0; i < 3; i++) {
			if(n.charAt(i) == '1') System.out.print(9);
			else if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i));
		} int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
			if(n.charAt(i) == '1') System.out.print(9);
			else if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i));
		} {
			if(n.charAt(i) == '1') System.out.print(9);
			else if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i));
		} if(n.charAt(i) == '1') System.out.print(9);
			else if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i)); n.charAt(i) == '1' n.charAt(i) n.charAt n i '1' System.out.print(9) System.out.print System.out System System.out 9 if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i)); n.charAt(i) == '9' n.charAt(i) n.charAt n i '9' System.out.print(1) System.out.print System.out System System.out 1 System.out.print(n.charAt(i)) System.out.print System.out System System.out n.charAt(i) n.charAt n i scan.close() scan.close scan public static void main(String[] args) {
		new Main().solve();
	} main {
		new Main().solve();
	} new Main().solve() new Main().solve new Main() String[] args args public class Main {
	void solve() {
		Scanner scan = new Scanner(System.in);
		String n = scan.next();
		for(int i = 0; i < 3; i++) {
			if(n.charAt(i) == '1') System.out.print(9);
			else if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i));
		}
		scan.close();
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
} public class Main {
	void solve() {
		Scanner scan = new Scanner(System.in);
		String n = scan.next();
		for(int i = 0; i < 3; i++) {
			if(n.charAt(i) == '1') System.out.print(9);
			else if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i));
		}
		scan.close();
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
} Main
import java.util.*;

public class Main {
	void solve() {
		Scanner scan = new Scanner(System.in);
		String n = scan.next();
		for(int i = 0; i < 3; i++) {
			if(n.charAt(i) == '1') System.out.print(9);
			else if(n.charAt(i) == '9') System.out.print(1);
			else System.out.print(n.charAt(i));
		}
		scan.close();
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
}
