import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        num = swap(num);
        System.out.println(num);
    }

    public static int swap(int num){
        if(num/100 == 9){
            num = num - 800;
        } else if(num/100 == 1){
            num = num + 800;
        } else {}
        
        if(num%100 >= 90 && num%100 <= 99){
            num = num - 80;
        } else if(num%100 >= 10 && num%100 <= 19){
            num = num + 80;
        } else {}

        if(num%10 == 9){
            num = num - 8;
        } else if(num%10 == 1){
            num = num + 8;
        } else {}

        return num;
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        num = swap(num);
        System.out.println(num);
    }

    public static int swap(int num){
        if(num/100 == 9){
            num = num - 800;
        } else if(num/100 == 1){
            num = num + 800;
        } else {}
        
        if(num%100 >= 90 && num%100 <= 99){
            num = num - 80;
        } else if(num%100 >= 10 && num%100 <= 19){
            num = num + 80;
        } else {}

        if(num%10 == 9){
            num = num - 8;
        } else if(num%10 == 1){
            num = num + 8;
        } else {}

        return num;
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        num = swap(num);
        System.out.println(num);
    } main {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        num = swap(num);
        System.out.println(num);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int num = scanner.nextInt(); num scanner.nextInt() scanner.nextInt scanner num = swap(num) num swap(num) swap num System.out.println(num) System.out.println System.out System System.out num String[] args args public static int swap(int num){
        if(num/100 == 9){
            num = num - 800;
        } else if(num/100 == 1){
            num = num + 800;
        } else {}
        
        if(num%100 >= 90 && num%100 <= 99){
            num = num - 80;
        } else if(num%100 >= 10 && num%100 <= 19){
            num = num + 80;
        } else {}

        if(num%10 == 9){
            num = num - 8;
        } else if(num%10 == 1){
            num = num + 8;
        } else {}

        return num;
    } swap {
        if(num/100 == 9){
            num = num - 800;
        } else if(num/100 == 1){
            num = num + 800;
        } else {}
        
        if(num%100 >= 90 && num%100 <= 99){
            num = num - 80;
        } else if(num%100 >= 10 && num%100 <= 19){
            num = num + 80;
        } else {}

        if(num%10 == 9){
            num = num - 8;
        } else if(num%10 == 1){
            num = num + 8;
        } else {}

        return num;
    } if(num/100 == 9){
            num = num - 800;
        } else if(num/100 == 1){
            num = num + 800;
        } else {} num/100 == 9 num/100 num 100 9 {
            num = num - 800;
        } num = num - 800 num num - 800 num 800 if(num/100 == 1){
            num = num + 800;
        } else {} num/100 == 1 num/100 num 100 1 {
            num = num + 800;
        } num = num + 800 num num + 800 num 800 {} if(num%100 >= 90 && num%100 <= 99){
            num = num - 80;
        } else if(num%100 >= 10 && num%100 <= 19){
            num = num + 80;
        } else {} num%100 >= 90 && num%100 <= 99 num%100 >= 90 num%100 num 100 90 num%100 <= 99 num%100 num 100 99 {
            num = num - 80;
        } num = num - 80 num num - 80 num 80 if(num%100 >= 10 && num%100 <= 19){
            num = num + 80;
        } else {} num%100 >= 10 && num%100 <= 19 num%100 >= 10 num%100 num 100 10 num%100 <= 19 num%100 num 100 19 {
            num = num + 80;
        } num = num + 80 num num + 80 num 80 {} if(num%10 == 9){
            num = num - 8;
        } else if(num%10 == 1){
            num = num + 8;
        } else {} num%10 == 9 num%10 num 10 9 {
            num = num - 8;
        } num = num - 8 num num - 8 num 8 if(num%10 == 1){
            num = num + 8;
        } else {} num%10 == 1 num%10 num 10 1 {
            num = num + 8;
        } num = num + 8 num num + 8 num 8 {} return num; num int num num public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        num = swap(num);
        System.out.println(num);
    }

    public static int swap(int num){
        if(num/100 == 9){
            num = num - 800;
        } else if(num/100 == 1){
            num = num + 800;
        } else {}
        
        if(num%100 >= 90 && num%100 <= 99){
            num = num - 80;
        } else if(num%100 >= 10 && num%100 <= 19){
            num = num + 80;
        } else {}

        if(num%10 == 9){
            num = num - 8;
        } else if(num%10 == 1){
            num = num + 8;
        } else {}

        return num;
    }
} public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        num = swap(num);
        System.out.println(num);
    }

    public static int swap(int num){
        if(num/100 == 9){
            num = num - 800;
        } else if(num/100 == 1){
            num = num + 800;
        } else {}
        
        if(num%100 >= 90 && num%100 <= 99){
            num = num - 80;
        } else if(num%100 >= 10 && num%100 <= 19){
            num = num + 80;
        } else {}

        if(num%10 == 9){
            num = num - 8;
        } else if(num%10 == 1){
            num = num + 8;
        } else {}

        return num;
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        num = swap(num);
        System.out.println(num);
    }

    public static int swap(int num){
        if(num/100 == 9){
            num = num - 800;
        } else if(num/100 == 1){
            num = num + 800;
        } else {}
        
        if(num%100 >= 90 && num%100 <= 99){
            num = num - 80;
        } else if(num%100 >= 10 && num%100 <= 19){
            num = num + 80;
        } else {}

        if(num%10 == 9){
            num = num - 8;
        } else if(num%10 == 1){
            num = num + 8;
        } else {}

        return num;
    }
}