#include<bits/stdc++.h>
#define Nur ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsgined long long
using namespace std;
int main(){
	Nur;
	string s;
	cin >> s;
	while(s[s.size()-1] == '0')
		s.erase(s.end() - 1, s.end());
	for(int i = s.size() - 1; i >= 0; i--){
		if(s[i] == '5') cout << '2';
		if(s[i] == '2') cout << '5';
		if(s[i] != '5' && s[i] != '2') cout << s[i];
	}
}
