#include <bits/stdc++.h>

using namespace std;
#define ll long long
int main()
{
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    ll p = 0;
    for(ll i=0; i<s.size();i++){
        if(s[i]=='2'){
            s[i]='5';
        }
        else if (s[i] == '5') s[i] = '2';
        if(s[i] == '0' && p == 1)cout << 0;
        if(s[i] != '0'){
            cout << s[i];
            p = 1;
        }
    }
}
