//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define all(x) x.begin(), x.end()
#define sz(x) x.size()
#define forik(x) ll i = 1; i <= x; i++

const int mod = 1e9 + 7;

using namespace std;
string s;
vector <char> v;

ll gcd (ll a, ll b){
	while (a > 0 && b > 0){
		if (a >= b){
			a %= b;
		}
		else{
			b %= a;
		}
	}
	return a + b;
}

ll binpow(ll a, ll b){
	a %= mod;
	if(b == 0){
		return 1;
	}
	if(b % 2 == 1){
		return binpow (a, b - 1) % mod * a;
	}
	if(b % 2 == 0){
		ll t = binpow (a, b / 2) % mod;
		return t * t % mod;
	}
}

signed main (){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	ll cnt = 0 , r = 0;
	cin >> s;
	for(int i = s.size() - 1 ; i >= 0 ; i--){
		v.pb(s[i]);
	}
	for(int i = 0 ; i < v.size() ; i++){
		if(v[i] == '0' && i == 0){
			cnt++;
		}
		if(cnt == 1 && v[i] != '0'){
			r = i;
			break;
		}
	}
	for(int i = 0 ; i < v.size() ; i++){
		if(v[i] == '2'){
			v[i] = '5';
			continue;
		}
		if(v[i] == '5'){
			v[i] = '2';
			continue;
		}
	}
	int x = 0;
	for(int i = r ; i < v.size() ; i++){
		cout << v[i];
		
	}
}
