#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define int long long
#define F first
#define S second
#define all(x, n, c) sort( x + c, x + n + c )
#define allv(x) sort( x.begin(), x.end() )
#define rev(x, n, c) reverse( x + c, x + n + c )
#define revv(x) reverse( x.begin(), x.end() )
#define sz(x) (x).size()
#define nl "\n"
#define IAmTheOneWhoKnocks ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

void solve()
{
    string s;
    cin >>s;
    revv(s);
    bool ch = 0;
    for( int i = 0; i < sz(s); i++ )
    {
        if( ( s[i] != '0' && ch == 0 ) || (ch == true) )
        {
            ch = true;
            if( s[i] == '2' )
            {
                s[i] = '5';
                cout <<s[i];
                continue;
            }
            if( s[i] == '5' )
            {
                s[i] = '2';
                cout <<s[i];
                continue;
            }
            cout <<s[i];
        }
    }
}

signed main()
{
    IAmTheOneWhoKnocks
    int T = 1;
    //cin >>T;
    while( T-- )
    { solve(); }
    return 0;
}
