import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        System.out.println(n-100*(n/100)+100*(10-(n/100))-n/10%10*10+(10-n/10%10)*10-n%10+(10-n%10));
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        System.out.println(n-100*(n/100)+100*(10-(n/100))-n/10%10*10+(10-n/10%10)*10-n%10+(10-n%10));
    }
} Main public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        System.out.println(n-100*(n/100)+100*(10-(n/100))-n/10%10*10+(10-n/10%10)*10-n%10+(10-n%10));
    } main {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        System.out.println(n-100*(n/100)+100*(10-(n/100))-n/10%10*10+(10-n/10%10)*10-n%10+(10-n%10));
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc System.out.println(n-100*(n/100)+100*(10-(n/100))-n/10%10*10+(10-n/10%10)*10-n%10+(10-n%10)) System.out.println System.out System System.out n-100*(n/100)+100*(10-(n/100))-n/10%10*10+(10-n/10%10)*10-n%10+(10-n%10) n-100*(n/100)+100*(10-(n/100))-n/10%10*10+(10-n/10%10)*10-n%10 n-100*(n/100)+100*(10-(n/100))-n/10%10*10+(10-n/10%10)*10 n-100*(n/100)+100*(10-(n/100))-n/10%10*10 n-100*(n/100)+100*(10-(n/100)) n-100*(n/100) n 100*(n/100) 100 (n/100) n 100 100*(10-(n/100)) 100 (10-(n/100)) 10 (n/100) n 100 n/10%10*10 n/10%10 n/10 n 10 10 10 (10-n/10%10)*10 (10-n/10%10) 10 n/10%10 n/10 n 10 10 10 n%10 n 10 (10-n%10) 10 n%10 n 10 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        System.out.println(n-100*(n/100)+100*(10-(n/100))-n/10%10*10+(10-n/10%10)*10-n%10+(10-n%10));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        System.out.println(n-100*(n/100)+100*(10-(n/100))-n/10%10*10+(10-n/10%10)*10-n%10+(10-n%10));
    }
} Main
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        System.out.println(n-100*(n/100)+100*(10-(n/100))-n/10%10*10+(10-n/10%10)*10-n%10+(10-n%10));
    }
}