import std.stdio,std.regex;

void main(){
	auto str = readln().chomp();

	str = str.replaceAll(regex(r"1"),"a");
	str = str.replaceAll(regex(r"9"),"1");
	str = str.replaceAll(regex(r"a"),"9");

	writeln(str);
	return;
}

import std.string,std.conv;

T[] readMany( T = size_t )(){
	T[] ret;
	foreach( val; readln().chomp().split() ){
		ret ~= val.to!T();
	}
	return ret;
}


