#import "stdio.h"

char exchange(char n) {
    switch (n){
        case '1':
            return '9';
        case '9':
            return '1';
        default:
            return n;
    }
}
int main(int argc, const char * argv[]) {
    @autoreleasepool {
        char a,b,c;
        scanf("%c%c%c", &a, &b, &c);
        printf("%c%c%c\n", exchange(a), exchange(b), exchange(c));
    }
    return 0;
}
