#include <bits/stdc++.h>

using namespace std;

int main()
{
    string n, m;
    cin >> n;
    for (int i = n.size(); i >= 0; i--) {
        if (n[i] > 57 || n[i] <= 48) {
            continue;
        }
        if (n[i] == '2') {
            m += '5';
            continue;
        }
        if (n[i] == '5') {
            m += '2';
            continue;
        }
        m += n[i];
    }
    while (m[0] == 48) {
        m.erase(0, 1);
    }
    cout << m << endl;
    return 0;
}
