import std.stdio, std.conv, std.string, std.range, std.typecons, std.format;
import std.algorithm.searching, std.algorithm.sorting, std.algorithm.iteration, std.algorithm.mutation;

void main()
{
    string input = readln().strip();
    foreach(c; input)
    {
        write(c=='1'?'9':'1');
    }
    writeln("");
}
