#include <iostream>
#include <string>
int main()
{
    std::string S, sub, bs = "";
    std::cin >> S;
    int i = 0;
    while (!(S.substr(i, 1).empty()))
    {
        //std::cout << "a" << std::endl;
        sub = S.substr(i, 1);
        if (sub == "6")
        {
            sub = "9";
        }
        else if (sub == "9")
        {
            sub = "6";
        }
        bs = sub + bs;
        i++;
    }
    std::cout << bs << std::endl;
}
#include<bits/stdc++.h>
#define N
using namespace std;
typedef long long ll;
string s;
int main(){
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='.')break;
		cout<<s[i];
	}
	return 0;
}
