#include <bits/stdc++.h>

using namespace std;

#define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define rall(s) s.rbegin(),s.rend()
#define all(s) s.begin(),s.end()
#define pb push_back
#define se second
#define fi first
#define ll long long
#define ld long double
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define yes cout<<"yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define no cout<<"no\n"


const int N = 5e5 + 9 , mod = 1e9 + 7;
ll   a[N] = {}, b[N] , c[N] , d[N] , dp[N];


void solve()
{
    ll q , i , j , m ,n, z ,s = 0 , f  = 0, l , r , k , x , y , mn  = 1e18 , mx = 0;
    string a;
    cin>>a;
    reverse(all(a));
    for(i=  0; i < a.size(); i++)
        if(a[i] == '2')
        a[i] = '5';
        else if(a[i] == '5')
            a[i] = '2';
    for(i = 0; i < a.size(); i++){
        if(a[i] == '0' && s == 0)
            continue;
            s = 1;
            cout<<a[i];
    }

}


int main(){

int t = 1;
//cin>>t;
while(t--)
     {
     solve();
     }
}
// Author : حسن
