
#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long a;
    cin >> a;
    while (a % 10 == 0) {
        a /= 10;
    }
    while (a > 0) {
        int b = a % 10;
        if (b == 2) {
            cout << 5;
        }
        else if (b == 5) {
            cout << 2;
        }
        else {
            cout << b;
        }
        a /= 10;
    }
}
