#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <random>
#include <chrono>

using namespace std;

using ll = long long;
using ld = long double;

mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define int long long
#define all(x) (x).begin(), (x).end()

void solve() {
    string s; cin >> s;
    reverse(all(s));
    bool need = true;
    ll n = s.size();
    for (ll i = 0;i<n;i++) {
        if (s[i] != '0') {
            need = false;
        }
        if (need && s[i] == '0') {
            continue;
        }
        if (s[i] == '5') {
            cout << 2;
            continue;
        }
        if (s[i] == '2') {
            cout << 5;
            continue;
        }
        cout << s[i];
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll timer = 1;
    // cin >> timer;
    while (timer--) {
        solve();
    }
    return 0;
}
