#include <iostream>
#include <string>

using namespace std;

int main(){
	string k;
	cin >> k;
	for(int i = k.length() - 1; i >= 0; i--){
		if(k[i] == '0' && i == k.length() - 1) continue;
		else if (k[i] == '2') cout << '5';
		else if(k[i] == '5') cout << '2';
		else cout << k[i];
	}
}
