#include <bits/stdc++.h>
#define ll long long



using namespace std;

void Xatab(){
    string s;cin>>s;
    reverse(s.begin(), s.end());
    for(int i=0; i<s.size(); ++i){
        if(s[i] == '0'){s.erase(s.begin()+i);i--;}
        else break;
    }
    for(int i=0; i<s.size(); ++i){
        if(s[i] == '2')s[i] = '5';
        else if(s[i] == '5')s[i] = '2';
    }
    cout<<s;
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll T = 1;//cin>>T;
    while(T--)Xatab();
    return 0;
}

