function main(arg) {
	arg = arg.split("\n")[0]
	var text = ""

	for (var i = 0; i < arg.length; i++) {
		if (arg[i] === "1") {
			text += "9"
		} else {
			text += "1"
		}
	}
	console.log(text)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));