#include <bits/stdc++.h>
using namespace std;
int main()
{
    vector<char> vc;
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++)
    {
        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++)
    {
        if(vc.back() != '0') break;
        vc.pop_back();
    }
    reverse(vc.begin(), vc.end());
    for(int i = 0; i < vc.size(); i++)
    {
        if(vc.back() != '0') break;
        vc.pop_back();
    }
    for(int i = 0; i < vc.size(); i++) cout << vc[i];
}
