#include <bits/stdc++.h>

using namespace std;

int main() {
    int k = 0;
    string s , s1 = "";
    cin >> s;
    reverse (s.begin() , s.end());
    for (int i = 0;i < s.size();i++) {
        if (s[i] != '0') {
            k = i;
            break;
        }
    }
    for (int i = k;i < s.size();i++) {
        s1 += s[i];
    }
    for (int i = 0;i < s1.size();i++) {
        if (s1[i] == '2') {
            s1[i] = '5';
        }
        else if (s1[i] == '5') {
            s1[i] = '2';
        }
    }
    cout << s1;
}
