#include <bits/stdc++.h>

using namespace std;

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

void solve() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '2') {
            s[i] = '5';
        }
        else if (s[i] == '5') {
            s[i] = '2';
        }
    }
    reverse(s.begin(), s.end());
    //cout << s << endl;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '0') {
            s[i] = 'a';
        }
        else {
            break;
        }
    }
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != 'a') {
            cout << s[i];
        }
    }
}


signed main()
{
    int t = 1;
    //cin >> t;
    //freopen("input.in", "r", stdin);
    while (t--) {
        solve();
    }
    return 0;
}

