#include <bits/stdc++.h>
#define ll long long
#define ff irst
#define ss second
#define pb push_back
#define mp make_pair

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int k = 0;
    while (s[s.size() - 1 - k] == '0')
        ++k;
    for (int i = s.size() - k - 1; i >= 0; --i) {
        if (s[i] == '2')
            cout << 5;
        else if (s[i] == '5')
            cout << 2;
        else
            cout << s[i];
    }
    return 0;
}
