'use strict'

function convertOneNine(target) {
    if(target == 1) return 9;
    if(target == 9) return 1;
}

function main(arg) {
    let answer = String(arg).split("").map(n=>convertOneNine(parseInt(n)));
    console.log(answer.join(""));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));