#include <bits/stdc++.h>
 
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define si set<int>
#define sz(s) (int)s.size()
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define all(v) v.begin(), v.end()
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define NO cout << "NO" << endl
#define YES cout << "YES" << endl
#define r0 return 0

using namespace std;

const int mod = 1e9 + 7, N = 1e5 + 5, INF = 1e9;
const long long INF2 = 1e18;

void solve(){
    string s;
    cin >> s;
    for(int i = sz(s) - 1; i >= 0; i--){
        if(s[i] == '0'){
            continue;
        }
        if(s[i] == '2'){
            cout << "5";
            continue;
        }
        if(s[i] == '5'){
            cout << "2";
            continue;
        }
        cout << s[i];
    }
}

void cf() {int tt;cin >> tt;while(tt--) {solve();}}

int main(){
	boost
	//cf();
	
	solve();

	r0;
}