import java.util.*;

public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        char[] ch = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < ch.length; i++) {
            if (ch[i] == '9') {
                sb.append('1');
            } else if (ch[i] == '1') {
                sb.append('9');
            }
        }
        System.out.println(sb.toString());
    }
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        char[] ch = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < ch.length; i++) {
            if (ch[i] == '9') {
                sb.append('1');
            } else if (ch[i] == '1') {
                sb.append('9');
            }
        }
        System.out.println(sb.toString());
    }
} Main public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        char[] ch = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < ch.length; i++) {
            if (ch[i] == '9') {
                sb.append('1');
            } else if (ch[i] == '1') {
                sb.append('9');
            }
        }
        System.out.println(sb.toString());
    } main {
	    Scanner sc = new Scanner(System.in);
        char[] ch = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < ch.length; i++) {
            if (ch[i] == '9') {
                sb.append('1');
            } else if (ch[i] == '1') {
                sb.append('9');
            }
        }
        System.out.println(sb.toString());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] ch = sc.next().toCharArray(); ch sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0; i < ch.length; i++) {
            if (ch[i] == '9') {
                sb.append('1');
            } else if (ch[i] == '1') {
                sb.append('9');
            }
        } int i = 0; int i = 0; i 0 i < ch.length i ch.length ch ch.length i++ i++ i {
            if (ch[i] == '9') {
                sb.append('1');
            } else if (ch[i] == '1') {
                sb.append('9');
            }
        } {
            if (ch[i] == '9') {
                sb.append('1');
            } else if (ch[i] == '1') {
                sb.append('9');
            }
        } if (ch[i] == '9') {
                sb.append('1');
            } else if (ch[i] == '1') {
                sb.append('9');
            } ch[i] == '9' ch[i] ch i '9' {
                sb.append('1');
            } sb.append('1') sb.append sb '1' if (ch[i] == '1') {
                sb.append('9');
            } ch[i] == '1' ch[i] ch i '1' {
                sb.append('9');
            } sb.append('9') sb.append sb '9' System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        char[] ch = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < ch.length; i++) {
            if (ch[i] == '9') {
                sb.append('1');
            } else if (ch[i] == '1') {
                sb.append('9');
            }
        }
        System.out.println(sb.toString());
    }
} public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        char[] ch = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < ch.length; i++) {
            if (ch[i] == '9') {
                sb.append('1');
            } else if (ch[i] == '1') {
                sb.append('9');
            }
        }
        System.out.println(sb.toString());
    }
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        char[] ch = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < ch.length; i++) {
            if (ch[i] == '9') {
                sb.append('1');
            } else if (ch[i] == '1') {
                sb.append('9');
            }
        }
        System.out.println(sb.toString());
    }
}