import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    readln.chomp.map!(a => a - '0').map!(a => a == 1 ? 9 : a == 9 ? 1 : a).each!write;
    writeln;
}

