#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
const int N=1000000001;

using namespace std;
/*
int main() {
    int n, m, k;
    cin >> n >> m >> k;

    vector<pair<int, int>> initialEdges;
    vector<pair<int, int>> finalEdges;

    set<pair<int, int>> initialEdgesSet;
    set<pair<int, int>> finalEdgesSet;

    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        initialEdges.push_back(make_pair(u, v));
        initialEdgesSet.insert(make_pair(u, v));
    }

    for (int i = 0; i < k; i++) {
        int u, v;
        cin >> u >> v;
        finalEdges.push_back(make_pair(u, v));
        finalEdgesSet.insert(make_pair(u, v));
    }


    //if (initialEdgesSet != finalEdgesSet) {


    vector<pair<int, int>> operations;

    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            if (initialEdgesSet.count(make_pair(i, j)) == 0) {

                operations.push_back(make_pair(i, j));
            }
        }
    }



    return 0;
}*/
int main()
{
    long long n;
    cin>>n;
    string s = to_string(n);
    int ogh=0;
    for (int i=s.size() - 1;i>=0;i--)
    {
        if (s[i] != '0' && ogh == 0)
        {
            ogh = 9;
        }
        if (ogh == 9)
        {
            if (s[i] == '5')
            {
                cout<<2;
                continue;
            }
            if (s[i] == '2')
            {
                cout<<5;
                continue;
            }
            cout<<s[i];
        }
    }
}
