#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main ()
{
    ll i ,n ,m , bz= 0 ,bzz=0, h1 =0 ;
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    n=s.size();


    for (i=0;i<n;i++)
    {
        if (bz==0 and s[i]=='0') {cout<<"";}
        else if (s[i]=='5') {cout<<"2";bz++;}
       else  if (s[i]=='2') {cout<<"5";bz++;}
        else {cout<<s[i];bz++;}
    }






    return 0;
}
