#include <bits/stdc++.h>

#define int long long
#define ll long long
#define ioigold ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define nl '\n'
#define sz(s) (int)s.size()
#define pb push_back   
#define con continue
#define S second
#define F first

using namespace std;

const int N = (int)3e5 + 7;
const int inF = (int)-1e9 - 7;
const int INF = (int)1e18 + 7;                                                  
const int mod = 1e9 + 7;

void solve(){
	string s;
	cin >> s;

	reverse(s.begin(), s.end());
	
	bool p = false;
	vector<char> ans;
	ll cnt = 0;
	for(int i = 0; i < sz(s); ++i){
		if(s[i] == '0' && cnt != 0){
			ans.pb(s[i]);
		}		
		else if(s[i] == '5'){
			ans.pb('2');
			cnt++;
		}
		else if(s[i] == '2'){
			ans.pb('5');
			cnt++;
		}
		else if(s[i] == '0' && cnt == 0){		
		}
		else{
			ans.pb(s[i]);
			cnt++;
		}
	}

	for(auto to : ans){
		cout << to ;
	}
}

main() {
	//freopen("complete.in", "r", stdin);
    //freopen("complete.out", "w", stdout);
	                                                                               
	ioigold                                             
	
    int T = 1;
    //cin >> T;

    while(T--){                                                     
    	solve();
    }
}