// input has entire input data
function Main(input) {
    // first line is in input[0], second line is in input[1], ..
    input = input.split("\n");
    // write solution here
    // 'let' was not available..
    var n = (input[0]);
    var ans = '';
    for (var i = 0; i < n.length; i++) {
        if (n[i] === '1') {
            ans += '9';
        } else {
            ans += '1';
        }
    }
    // console.log will write a line to standard output (with line break at end)
    console.log(ans);
}

// do not edit lines below (reads entire standard input to call Main)
// this did not read input from VS Code integrated terminal, nor terminal
Main(require("fs").readFileSync("/dev/stdin", "utf8"));