#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){
	string s;
	cin>>s;
	bool ok=0;
	reverse(s.begin(),s.end());
	for(int i=0;i<s.size();i++){
	    if(s[i]!='0'){
	        ok=1;
	    }
		if(s[i]=='5'){
			cout<<'2';
			continue;
		} 
		else if(s[i]=='2'){
			cout<<'5';
			continue;
			}
		if(s[i]=='0' && ok==0){
		    continue;
		}
		cout<<s[i];
		}
		return 0;
	}
