#include <bits/stdc++.h>

#define fi first
#define se second

#define pw(x) (1LL << x)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define sz(x) (int)(x).size()

using namespace std;

template < typename T >
bool umn (T& a, T  b) {return a > b ? a = b, 1 : 0;}
template < typename T >
bool umx (T& a, T  b) {return a < b ? a = b, 1 : 0;}

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

const int N = 1e6 + 5;

int main() {
#ifdef localy
    freopen ("input.txt", "r", stdin);
    freopen ("output.txt", "w", stdout);
#endif // localy
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    string s;
    cin >> s;
    reverse(all(s));
    int id = 0;
    for (int i = 0; i < sz(s); i++) {
        if (s[i] != '0') {
            id = i;
            break;
        }
    }
    string sub;
    for (int i = id; i < sz(s); i++) {
        if (s[i] == '2') sub += "5";
        else if (s[i] == '5') sub += "2";
        else sub += s[i];
    }
    cout << sub << endl;

    return 0;
}
