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