"use strict";
function Main(input) {
    let n = input.split("\n")[0].split("").map((v) => v - 0).map(
        function(v) {
            switch (v) {
            case 1: return 9;
            case 9: return 1;
            default: return v;
            }
        }        
    );
    let ans = n.join("");
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
