#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve()
{
    string x;
    cin>>x;
    string y;
    reverse(x.begin(),x.end());
    if (x[0] != '0')
    {
        cout << x[0];
    }
    for (ll i = 1; i < x.size(); i++)
    {
        if (x[i] == '2')
        {
            x[i] = '5';
        }
        else if (x[i] == '5')
        {
            x[i] = '2';
        }
        else
        {
            continue;
        }
    }
    for (ll i = 1; i < x.size(); i++)
    {
        cout << x[i];
    }
}
int main ()
{
    ll T=1;
    //cin >> T;
    while(T --)
    {
      solve ();
    }
}
