#include <bits/stdc++.h>
using namespace std;
int main()
{
    string in, ans = "";
    cin >> in;
    int pos;
    reverse(in.begin(), in.end());
    for (int i = 0; i < in.size(); i++)
    {
        if (in[i] != '0')
        {
            pos = i;
            break;
        }
    }
    for (int i = pos; i < in.size(); i++)
    {
        if (in[i] == '5')
        {
            ans += '2';
        }
        else if (in[i] == '2')
        {
            ans += '5';
        }
        else
        {
            ans += in[i];
        }
    }
    cout<<ans;
}
