import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = n % 10;
        int b = n / 10 % 10;
        int c = n / 100 % 10;
        if(a == 1) a = 9;
        else a = 1;
        if(b == 1) b = 9;
        else b = 1;
        if(c == 1) c = 9;
        else c = 1;
        System.out.println(c*100+b*10+a);
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
    public static int saiyaku(int a, int b) {
        if(a < b) return saiyaku(b, a);
        if(b == 0) return a;
        int w = b;
        a = a % b;
        b = w;
        return saiyaku(a, b);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = n % 10;
        int b = n / 10 % 10;
        int c = n / 100 % 10;
        if(a == 1) a = 9;
        else a = 1;
        if(b == 1) b = 9;
        else b = 1;
        if(c == 1) c = 9;
        else c = 1;
        System.out.println(c*100+b*10+a);
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
    public static int saiyaku(int a, int b) {
        if(a < b) return saiyaku(b, a);
        if(b == 0) return a;
        int w = b;
        a = a % b;
        b = w;
        return saiyaku(a, b);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = n % 10;
        int b = n / 10 % 10;
        int c = n / 100 % 10;
        if(a == 1) a = 9;
        else a = 1;
        if(b == 1) b = 9;
        else b = 1;
        if(c == 1) c = 9;
        else c = 1;
        System.out.println(c*100+b*10+a);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = n % 10;
        int b = n / 10 % 10;
        int c = n / 100 % 10;
        if(a == 1) a = 9;
        else a = 1;
        if(b == 1) b = 9;
        else b = 1;
        if(c == 1) c = 9;
        else c = 1;
        System.out.println(c*100+b*10+a);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int a = n % 10; a n % 10 n 10 int b = n / 10 % 10; b n / 10 % 10 n / 10 n 10 10 int c = n / 100 % 10; c n / 100 % 10 n / 100 n 100 10 if(a == 1) a = 9;
        else a = 1; a == 1 a 1 a = 9 a 9 a = 1 a 1 if(b == 1) b = 9;
        else b = 1; b == 1 b 1 b = 9 b 9 b = 1 b 1 if(c == 1) c = 9;
        else c = 1; c == 1 c 1 c = 9 c 9 c = 1 c 1 System.out.println(c*100+b*10+a) System.out.println System.out System System.out c*100+b*10+a c*100+b*10+a c*100 c 100 b*10 b 10 a String[] args args public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    } min {
        if(a <= b) return a;
        else return b;
    } if(a <= b) return a;
        else return b; a <= b a b return a; a return b; b int a a int b b public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    } max {
        if(a <= b) return b;
        else return a;
    } if(a <= b) return b;
        else return a; a <= b a b return b; b return a; a int a a int b b public static int saiyaku(int a, int b) {
        if(a < b) return saiyaku(b, a);
        if(b == 0) return a;
        int w = b;
        a = a % b;
        b = w;
        return saiyaku(a, b);
    } saiyaku {
        if(a < b) return saiyaku(b, a);
        if(b == 0) return a;
        int w = b;
        a = a % b;
        b = w;
        return saiyaku(a, b);
    } if(a < b) return saiyaku(b, a); a < b a b return saiyaku(b, a); saiyaku(b, a) saiyaku b a if(b == 0) return a; b == 0 b 0 return a; a int w = b; w b a = a % b a a % b a b b = w b w return saiyaku(a, b); saiyaku(a, b) saiyaku a b int a a int b b public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = n % 10;
        int b = n / 10 % 10;
        int c = n / 100 % 10;
        if(a == 1) a = 9;
        else a = 1;
        if(b == 1) b = 9;
        else b = 1;
        if(c == 1) c = 9;
        else c = 1;
        System.out.println(c*100+b*10+a);
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
    public static int saiyaku(int a, int b) {
        if(a < b) return saiyaku(b, a);
        if(b == 0) return a;
        int w = b;
        a = a % b;
        b = w;
        return saiyaku(a, b);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = n % 10;
        int b = n / 10 % 10;
        int c = n / 100 % 10;
        if(a == 1) a = 9;
        else a = 1;
        if(b == 1) b = 9;
        else b = 1;
        if(c == 1) c = 9;
        else c = 1;
        System.out.println(c*100+b*10+a);
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
    public static int saiyaku(int a, int b) {
        if(a < b) return saiyaku(b, a);
        if(b == 0) return a;
        int w = b;
        a = a % b;
        b = w;
        return saiyaku(a, b);
    }
} Main
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = n % 10;
        int b = n / 10 % 10;
        int c = n / 100 % 10;
        if(a == 1) a = 9;
        else a = 1;
        if(b == 1) b = 9;
        else b = 1;
        if(c == 1) c = 9;
        else c = 1;
        System.out.println(c*100+b*10+a);
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
    public static int saiyaku(int a, int b) {
        if(a < b) return saiyaku(b, a);
        if(b == 0) return a;
        int w = b;
        a = a % b;
        b = w;
        return saiyaku(a, b);
    }
}