#include <iostream>
#include <string>
using namespace std;
int main()
{
    bool flag = false;
    string k;
    cin >> k;
    for (int i = k.length() - 1; i >= 0; i--)
    {
        if (flag == false and k[i] == '0') continue;
        else {
            flag = true;
            if (k[i] == '5') cout << 2;
            else if (k[i] == '2') cout << 5;
            else cout << k[i];
        }

    }
            return 0;
        }