#include<bits/stdc++.h>
using namespace std;
int main(){
	string u;
	cin>>u;
	for(int i = u.size(); i >= 0; i--){
		if(u[i] == '2') u[i] = '5';
		else if(u[i] == '5') u[i] = '2';
	}
	reverse(u.begin(), u.end());
	while(u[0] == '0'){
		u.erase(0,1);
	}
	cout<<u<<'\n';
	return 0;
}