'use strict';
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\s/);
const N = input[0];

const result = N.replace(/1/g, 'a').replace(/9/g, '1').replace(/a/g, '9')

console.log(result);