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