#include <bits/stdc++.h>

#define int long long
#define pii pair<long long, long long>
#define ios_boost \
    cin.tie(0);   \
    ios_base::sync_with_stdio(0)

using namespace std;

signed main() {
    ios_boost;

    string s; cin>>s;
    reverse(s.begin(), s.end());
    int i = 0;
    while (s[i] == '0') i++;
    for(; i<s.size(); i++){
        if(s[i]=='2') cout<<"5";
        else if(s[i]=='5') cout<<"2";
        else cout<<s[i];
    }
}
