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

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