#include <bits/stdc++.h>

using namespace std;

#define ll long long

void solve(){
	string s;
	cin >> s;
	reverse (s.begin() , s.end());
	ll x=0;
	while (s[x]=='0')x++;
	for (int i = x ; i < s.size() ; i++){
		if (s[i]=='5')cout << "2";
		else if (s[i]=='2')cout << "5";
		else cout << s[i];
	}
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
	return 0;
}