#include <bits/stdc++.h>
using namespace std;
int main()
{
    vector<char> vc;
    string s;
    cin >> s;
    for(int i = s.size() - 1; i >= 0; i--)
    {
        if(s[i] != '0')
        {
            if(s[i] == '2') vc.push_back('5');
            else if(s[i] == '5') vc.push_back('2');
            else vc.push_back(s[i]);
        }
    }
    for(int i = 0; i < vc.size(); i++) cout << vc[i];
}
