#include "bits/stdc++.h"
using namespace std;
 
#define ff first
#define sz size
#define in insert
#define sp " "
#define pb push_back
#define ss second
typedef long long ll;
typedef long double ld;
#define rall(x) (x).rbegin(), (x).rend()
#define all(x) (x).begin(), (x).end()
 
ll gcd (ll a, ll b) {
    return b ? gcd (b, a % b) : a;
}
ll lcm (ll a, ll b) {
    return a / gcd (a, b) * b;
}
 
const ll N = (ll)1e5+7;
const ll M = (ll)1e9+7;
const ll mn = LLONG_MIN;
const ll mx = LLONG_MAX;

bool chk(ll r, ll n, ll w, ll h){
    return ((r/h)*(r/w)>=n);
}
 
 
void solve() {
    string s; 
    cin>>s;
    reverse(all(s));
    // cout<<s<<"\n";
    bool ck=0;
    vector<char>v;
    ll cnt=0;
    for(ll i=0; i<s.sz(); i++){
        if(s[i]>'0')ck=1;
        if(ck){
            if(s[i]=='5')v.pb('2');
            else if(s[i]=='2')v.pb('5');
            else v.pb(s[i]);
        // cnt++;
        } 

    }
    for(ll i=0; i<v.sz(); i++){
        cout<<v[i];
    }
}

signed main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
 
    ll T = 1;
    // cin>>T;
    while(T--) solve();
}
