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