#include <bits/stdc++.h>
using namespace std;
int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    string a;
    string javob = "";
    cin >> a;
    long long quantity = a.size();
    reverse(a.begin(), a.end());
    bool flag = false;
    for(long long i = 0; i < quantity; i = i + 1) {
        if(a[i] == '5') {
            javob.push_back('2');
        }
        else if(a[i] == '2' ){
            javob.push_back('5');
        }
        else {
            javob.push_back(a[i]);
        }
    }

    for(auto number:javob){
        if(number != '0') {
            flag = true;
        }
        if(flag == true)
        {
            cout << number;
        }
    }
}
