#include <bits/stdc++.h>
using namespace std;
 
#ifdef LOCAL
#include "debugger.cpp"
#else
#define debug(...)
#endif
#define ll long long
#define pb push_back
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950288419716939937510
#define vi vector<int>
#define vll vector<ll>
#define llmax 2e18
#define inf 1e9+2
bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; }
#define all(a) (a).begin(), (a).end()
#define rep(i, a, b) for(ll i=a; i<b; i++)
vll input(ll n){vll a;rep(i,0,n){ll x;cin >> x;a.pb(x);}return a;}
ll minn(vll a, ll n){ll mn = 1e18;rep(i,0,n){mn = min(mn, a[i]);}return mn;}
ll maxx(vll a, ll n){ll mx = 0;rep(i,0,n){mx = max(mx, a[i]);}return mx;}
ll sum(vll a, ll n){ll sm = 0;rep(i,0,n){sm+=a[i];}return sm;}

vector<ll> sieve(int n){vector<ll> res;bool prm[n + 1];memset(prm, true, sizeof(prm));for (int p = 2; p * p <= n; p++) {if (prm[p] == true) {for (int i = p * p; i <= n; i += p)prm[i] = false;}}for (int p = 2; p <= n; p++)if (prm[p])res.pb(p);
    return res;
}
int findmex(vector<int> v, int n){
    unordered_set<int> s;
    for(int i=0;i<n+2; i++){
        s.insert(i);
    }
    for(auto val:v) if (s.find(val)!=s.end()) s.erase(val);
    return *min_element(all(s));}
struct Point{
    int x, y;
};
long long lcm(ll a, ll b)
{
    return (a / gcd(a, b)) * b;
}
int isSubstring(string s1, string s2)
{
    if (s2.find(s1) != string::npos)
        return s2.find(s1);
    return -1;
}
ll bincnt(ll n)
{
    ll cnt = 0;
    for (ll i = 63; i >= 0; i--) {
        ll k = n >> i;
        if (k & 1)cnt++;
    }
    return cnt;
}

void solve()
{
    string s;
    cin >> s;
    int ind = s.size() - 1;
    for(int i = s.size() - 1; i >= 0; i--){
        if(s[i] == '0'){
            ind--;
        }
        else{
            break;
        }
    }
    debug(ind);
    for(int i = ind; i >= 0; i--){
        if(s[i] == '2'){
            cout << 5;
        }
        else if(s[i] == '5'){
            cout << 2;
        }
        else cout << s[i];
    }
}







main(){
    auto start = chrono::high_resolution_clock::now();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tests = 1;
    //cin >> tests;
    while(tests--){
        solve();
        cout << '\n';
    }

    #ifdef LOCAL
    cout << "\n__________________________" << endl;
    auto duration = chrono::duration_cast<chrono::microseconds>(chrono::high_resolution_clock::now() - start);
    cout << "time: " << (double)(duration.count())/1000.0 << " ms" << endl;
    #endif
    
/* Orifkhon Telegram username : @orifkhon_husanov_off */
}