#include <bits/stdc++.h>

using namespace std;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<vector<int>>;
using ll = long long;
using uii = unordered_map<int, int>;
using ui = unordered_set<int>;


#define MOD 1000000007
#define INF 1e9
#define FOR(a, b, c) for (int a = b; a < c; ++a)
#define FORF(a, b, c) for (int a = b; a <= c; ++a)
#define FORB(a, b, c) for (int a = b; a >= c; --a)
#define sc second
#define fr first




void solve() {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    string answer = "";
    FOR(i,0,s.size()){
        if (i == 0 && s[i] == '0') continue;

        if (s[i] == '5') answer += '2';
        else if(s[i] == '2') answer += '5';
        else answer += s[i];
    }
    cout << answer << "\n";
}


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

