'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', function(inputStdin) {
    inputString += inputStdin;
});

process.stdin.on('end', function() {
    inputString = inputString.split('\n');

    main();
});

function readline() {
    return inputString[currentLine++];
}



function main() {

    var s = readline()
    var k = s.replace(/1/g, '9').replace(/9/g, '1')
    console.log(k)
}

//
