#include<bits/stdc++.h>

using namespace std;

int main() {
    string s;
    cin >> s;
    while((int)s.size() > 1 && s.back() == '0') {
        s.pop_back();
    }
    string t = s;
    reverse(t.begin(), t.end());
    for(auto x : t) {
        if(x == '2') {
            cout << '5';
        } else if(x == '5') {
            cout << '2';
        } else {
            cout << x;
        }
    }
    return 0;
}

