#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;

void solve() {
    string k;
    cin >> k;
    reverse(k.begin(), k.end());
    int x = 0;
    for (int i = 0; i < k.size(); ++i) {
        if (k[i] == '0' and x == 0)
            continue;
        if (k[i] == '2') {
            cout << 5;
            x = 1;
        } else if (k[i] == '5') {
            cout << 2;
            x = 1;
        } else {
            cout << k[i];
            x = 1;
        }


    }
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#endif
    int t = 1;
//    cin >> t;
    while (t--) solve();
}

