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

using namespace std;


signed main(){
    
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    int T = 1;
//    cin >> T;
    while(T --) {
    	string s;
    	cin >> s;
    	reverse(s.begin(), s.end());
    	for(int i = 0; i < s.size(); i ++) {
    		if(s[i] == '2') {
    			cout << '5';
    			continue;
			}
			if(s[i] == '5') {
				cout << '2';
				continue;
			}
    		if(s[i] != '0') {
    			cout << s[i];
			}
		}
    }
}
