    /*
Muqalzhar taui
*/
#include <bits/stdc++.h>
#include <iomanip>
   
#define ll long long
#define pb push_back
#define F first
#define S second
#define nl '\n'
#define all(x) x.begin(), x.end()
   
const int N = 2e5 + 7;
const int modd = 1e9 + 7;
const int INF = 1e9 + 7;
const double pi = 3.141592653589793238462643383279502884197;
using namespace std;
 
string s;
void solve(){
	cin >> s;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '5') s[i] = '2';
		else if(s[i] == '2') s[i] = '5';
	}
	string h = "";
	for(int i = s.size() - 1; i >= 0; i--){
		if(s[i] != '0' || h.size() != 0) h = s[i] + h;
	}
	reverse(all(h));
	cout << h;
    return;
} 
   
int main(){
    // freopen("pails.in", "r", stdin);
    //  freopen("pails.out", "w", stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
      
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}