#include <bits/stdc++.h>
  
#define int long long
  
using namespace std;
 
main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string s;
	cin >> s;
	reverse(s.begin(), s.end());
	for(int i = 0; i < s.size(); ++i) {
		if(s[i] == '2') {
			s[i] = '5';
		} else if(s[i] == '5') {
			s[i] = '2';
		}
	}
	int h = 0;
	while(s[h] == '0') {
		h ++;
	}
	cout << s.substr(h, s.size() - h);
}
