#include <bits/stdc++.h>
using namespace std;
#define accepted ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Daulbekov signed    
#define Makan main
#define int long long
#define double long double

Daulbekov Makan(){
	accepted
	string s;
	cin>>s;
	reverse(s.begin(),s.end());
	bool z=0;
	for (int i=0; i<s.size(); i++)
	{
		if (s[i]=='0'&&z==0)
		{
		}
		else {
			z=1;
			if (s[i]=='2')
			{
				cout<<5;
			}
			else if (s[i]=='5')
			{
				cout<<2;
			}
			else {
				cout<<s[i];
			}
		}
	}
}