'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const n = args[0][0]
	let a = null
	let b = null
	let c = null

	if (n[0] === '1') a = '9'
	else if (n[0] === '9') a = '1'
	else a = n[0]

	if (n[1] === '1') b = '9'
	else if (n[1] === '9') b = '1'
	else b = n[1]

	if (n[2] === '1') c = '9'
	else if (n[2] === '9') c = '1'
	else c = n[2]

	console.log(`${a}${b}${c}`)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
