#include <iostream>
using namespace std;

int main()
{
	string k;
	cin >> k;
	bool isNull = false;
	string answer = "";

	for (int i = k.length() - 1; i >= 0; i--) {
		if (k[i] == '0' && isNull == false) {
			continue;
		}
		else if (k[i] == '5') {
			isNull = true;
			answer += "2";
		}
		else if (k[i] == '2') {
			isNull = true;
			answer += "5";
		}
		else {
			isNull = true;
			answer += k[i];
		}
	}
	cout << answer;


}