#include <bits/stdc++.h>
using namespace std;
 
int main() {
	string a;
	cin >>a;
	int i =a.size()-1;
	int k = 1;
	for (int j = a.size()-1; j >= 0; j--){
		if (a[a.size()-k] == '0'){
			k++;
			i=a.size()-k;
		}
		else{
			break;
		}
	}
	for(; i >= 0; i--){
		if (a[i] == '2'){
			a[i] = '5';
			cout<<a[i];
			continue;
		}
		else if (a[i] == '5'){
			a[i] = '2';
			cout<<a[i];
			continue;
		}
		else{
			cout<<a[i];
			continue;
		}
	}
	return 0;
}
