#include <bits/stdc++.h>

#define pudge ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
//typedef tuple<ll, ll, ll> tll;

const ll INF = 2e18;
const double PI = acos(-1);
const ll MOD7 = 1e9 + (1000 - 7);
const ll MOD9 = 1e9 + 9;
const ll P = 31;
const ld E = 1e-6;
//const ll N = 6250001;
const ll N = 1000006;


int main() {
    pudge;

//    freopen("minmax.in", "r", stdin);
//    freopen("minmax.out", "w", stdout);

    string s, ans;
    cin >> s;
    int flag = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '5') ans.push_back('2');
        else if (s[i] == '2') ans.push_back('5');
        else ans.push_back(s[i]);
    }
    reverse(ans.begin(), ans.end());
    int r = 0, n = ans.size();
    for (int i = 0; i < n; i++) {
        if (ans[i] != '0') break;
        r++;
    }
    for (int i = r; i < n; i++) {
        cout << ans[i];
    }
    return 0;
}
