fun main (args : Array<String>) {
	val n = readLine()!!.toString()
	var result : String = ""
	for (i in n) {
		if (i.toString() == "1") {
			result += "9"
		} else if (i.toString() == "9") {
			result += "1"
		}
	}
	println("${result}")
}