#include<bits/stdc++.h>

using namespace std;

int main() {
    long long k, n;
    cin >> k;
    string s = "";
    while (k > 0) {
        n = k % 10;
        if (n == '2' - 48) {
            s += "5";
        }
        else if (n == '5' - 48) {
            s += "2";
        }
        else if (n != '0' - 48) {
            s += n + 48;
        }
        k /= 10;
    }
    cout << s;
}
