object Main extends App {
	val n = scala.io.StdIn.readInt
	var a = n/100
	var b = (n%100)/10
	var c = n%10

	a match {
		case 1 => a = 9
		case 9 => a = 1
		case _ => 
	}

	b match {
		case 1 => b = 9
		case 9 => b = 1
		case _ => 
	}

	c match {
		case 1 => c = 9
		case 9 => c = 1
		case _ => 
	}

	println(100*a + 10*b + c)


} 
