#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
#pragma GCC target("avx,avx2,fma")

#define int long long
#define damkk ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) ;
#define pb push_back
#define sz size()
#define F first
#define S second
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout);
#define all(s) (s).begin(),(s).end()
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define yes cout << "Yes\n";
#define no cout << "No\n";

using namespace std ;

const int MaxN = 100010;
const int inf = 1e9 + 99;
const int MOD = 1e9 + 7 ;
const long double eps = 1e-6;

int binpow(int a , int b){
	if(b == 0){
		return 1;
	}
	if(b % 2 == 1){
		return binpow(a , b - 1) * a % MOD;
	}
	else{
		int val = binpow(a , b / 2);
		return val * val % MOD;
	}
}

void solve(){
	string s;
    cin >> s;
    reverse(s.begin() , s.end());
    int cnt = 0;
    for(int i =0;  i < s.sz; i++){
      	if((i == 0 || cnt == 0) && s[i] == '0'){
        	continue;
    }
    	if(s[i] == '2'){
      		cnt++;
      		cout << '5';
    }
    	else if(s[i] == '5'){
      		cnt++;
      		cout << '2';
    }
    	else{
     	cout << s[i];
      	cnt++;
    	}
  	}
}	

main()
{
	damkk
    //file()
    int tt = 1;
    //cin >> tt;
    while(tt--){
    	solve();
	}
}


