#include <iostream>
#include <cmath>
#include <map>
#include <vector>
#include <algorithm>
#include <time.h>
#include <queue>
#include <unordered_set>
#include <fstream>
#include <set>
#include <unordered_map>

using namespace std;
#define ll long long

ll binpow (ll a, ll n) {
	ll res = 1;
	while (n) {
		if (n & 1)
			res = res * a;
		a = a * a;
		n >>= 1;
	}
	return res;
}


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


int main (){
	
	
	int T=1;
	//cin>>T;
	while (T--)  fc();
  
  
  
}
