#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const ll inf = 998244353;

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