#include <bits/stdc++.h>   using namespace std;   int main(int argc, char const *argv[]) {     string input;     cin >> input;     int i = 0;     if (input[0] ==  9 ) ++i;     for (; i < input.length(); ++i) {       if (input[i] >=  5 ) {         input[i] =  0  +  9  - input[i];       }     }     for (int j = 0; j < input.length(); ++j) {       cout << input[j];     }     cout << endl;     return 0;   }   