#include <bits/stdc++.h>
using namespace std;

int main(){
	string s;
	cin >> s;
	
	long long n = s.size();
	
	int id = n-1;
	while(s[id] == '0'){
		id--;
	}
	
	for(int i=id; i>=0; i--){
	
		if(s[i] == '5'){
			s[i] = '2';
		}
		else if(s[i] == '2'){
			s[i] = '5';
		}
		cout << s[i];
		
	}
}
