#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
    string s;
    cin >> s;
    int x = s.size();
    for (int i = s.size() - 1; i >= 0; --i) {
        if (s[i] != '0') {
            break;
        } else {
            x = i;
        }
    }
    for (int i = x - 1; i >= 0; --i) {
        if (s[i] == '2') {
            cout << 5;
            continue;
        } else if (s[i] == '5'){
            cout << 2;
            continue;
        }
        cout << s[i];
    }
    return 0;
}










