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