import java.util.*;
//import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		sc.close();
		StringBuilder ans = new StringBuilder();
		for(i=0;i<n.length();i++) {
			switch(n.charAt(i)) {
			case '1':
				ans.append("9");
				break;
			case '9':
				ans.append("1");
				break;
			default:
				ans.append(n.charAt(i));
				break;
			}
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		sc.close();
		StringBuilder ans = new StringBuilder();
		for(i=0;i<n.length();i++) {
			switch(n.charAt(i)) {
			case '1':
				ans.append("9");
				break;
			case '9':
				ans.append("1");
				break;
			default:
				ans.append(n.charAt(i));
				break;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		sc.close();
		StringBuilder ans = new StringBuilder();
		for(i=0;i<n.length();i++) {
			switch(n.charAt(i)) {
			case '1':
				ans.append("9");
				break;
			case '9':
				ans.append("1");
				break;
			default:
				ans.append(n.charAt(i));
				break;
			}
		}
		System.out.println(ans);
	} main {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		sc.close();
		StringBuilder ans = new StringBuilder();
		for(i=0;i<n.length();i++) {
			switch(n.charAt(i)) {
			case '1':
				ans.append("9");
				break;
			case '9':
				ans.append("1");
				break;
			default:
				ans.append(n.charAt(i));
				break;
			}
		}
		System.out.println(ans);
	} int i i j; j Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc sc.close() sc.close sc StringBuilder ans = new StringBuilder(); ans new StringBuilder() for(i=0;i<n.length();i++) {
			switch(n.charAt(i)) {
			case '1':
				ans.append("9");
				break;
			case '9':
				ans.append("1");
				break;
			default:
				ans.append(n.charAt(i));
				break;
			}
		} i=0; i=0 i 0 i<n.length() i n.length() n.length n i++ i++ i {
			switch(n.charAt(i)) {
			case '1':
				ans.append("9");
				break;
			case '9':
				ans.append("1");
				break;
			default:
				ans.append(n.charAt(i));
				break;
			}
		} {
			switch(n.charAt(i)) {
			case '1':
				ans.append("9");
				break;
			case '9':
				ans.append("1");
				break;
			default:
				ans.append(n.charAt(i));
				break;
			}
		} switch(n.charAt(i)) {
			case '1':
				ans.append("9");
				break;
			case '9':
				ans.append("1");
				break;
			default:
				ans.append(n.charAt(i));
				break;
			} n.charAt(i) n.charAt n i case '1': '1' case '1': ans.append("9") ans.append ans "9" break; case '9': '9' case '9': ans.append("1") ans.append ans "1" break; default: default: ans.append(n.charAt(i)) ans.append ans n.charAt(i) n.charAt n i break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		sc.close();
		StringBuilder ans = new StringBuilder();
		for(i=0;i<n.length();i++) {
			switch(n.charAt(i)) {
			case '1':
				ans.append("9");
				break;
			case '9':
				ans.append("1");
				break;
			default:
				ans.append(n.charAt(i));
				break;
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		sc.close();
		StringBuilder ans = new StringBuilder();
		for(i=0;i<n.length();i++) {
			switch(n.charAt(i)) {
			case '1':
				ans.append("9");
				break;
			case '9':
				ans.append("1");
				break;
			default:
				ans.append(n.charAt(i));
				break;
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.*;
//import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		sc.close();
		StringBuilder ans = new StringBuilder();
		for(i=0;i<n.length();i++) {
			switch(n.charAt(i)) {
			case '1':
				ans.append("9");
				break;
			case '9':
				ans.append("1");
				break;
			default:
				ans.append(n.charAt(i));
				break;
			}
		}
		System.out.println(ans);
	}
}
