#include<bits/stdc++.h>
using namespace std;
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define ll long long
#define pb push_back;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define se second
#define fi first
double  pi=3.1415926535897932384626433832795;
///HELLOUUUUUUUU WORLD
ll fuc(ll n)
{
    ll sum=0;
    sum+=n%10;
    n/=10;
    sum+=n%10;
    n/=10;
    sum+=n%10;
    n/=10;
    sum+=n%10;
    n/=10;
    sum+=n%10;
    n/=10;
    sum+=n%10;
    n/=10;
    sum+=n%10;
    n/=10;
    sum+=n%10;
    n/=10;
    sum+=n%10;
    n/=10;
    return sum;
}
///__builtin_popcount(ar[i]^ar[b]);
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define ll long long
#define pb push_back;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define se second
#define fi first
ll privet(ll a)
{
    ll mn = 10, mx = 0;
    while (a > 0)
    {
        ll d = a % 10;
        a /= 10;
        mn = min(mn,d);
        mx = max(mx,d);
    }
    return mn * mx;
}
bool salom(ll n)
{
    for (ll i = 2 ; i <= sqrt(n); i++)
    {
        if (n % i == 0)
        {
            return false;
        }
    }
    return true;
}
const ll val = (2e5) + 7;

ll func(ll  n)
{
    return n*(n+1)/2;
}
vector<pair<ll,ll>>vc(val);
using namespace std;
ll mp[1000000];
void wrongontest2()
{
    string s;
    cin >> s;
    reverse(s.begin(),s.end());
    for(int i = 0; i < s.size(); ++i)
    {
        if(s[i]=='0')
        {
            continue;
        }
        if(s[i]=='2')
        {
            s[i]='5';
        }
        else if(s[i]=='5')
        {
            s[i]='2';
        }
        cout << s[i];
    }
}
int main ()
{
    ll T=1;
    //cin >> T;
    while(T --)
    {
      wrongontest2();
    }
}
