#include <vector>
#include <string>
#include <map>
#include <set>
#include <iostream>

using namespace std;
using ll = long long;

int main()
{
    
    string s;
    cin >> s;
    int end = 1;
    for (int i = s.size() - 1; i >= 0; i--) {
        if (s[i] == '2') {
            cout << '5';
            end = 0;
        }
        else if (s[i] == '5') {
            cout << 2;
            end = 0;
        }
        else if (s[i] == '0') {
            if (end != 1)
            {
                cout << '0';
            }
        }
        else {
            cout << s[i];
            end = 0;
        }

    }
};