#include <bits/stdc++.h>
#define int long long
#define str string
#define iphone ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define p_b push_back
#define first ff
#define second ss
using namespace std;
signed main(){
	str s;
	cin>>s;
	for (int i=s.size()-1;i>=0;i--) {
		if (s[i]=='2') cout<<'5';
		else if (s[i]=='5') cout<<'2';
		else if (s[i]!='0') cout<<s[i];
	}
 }
/*
alignasa
alignasaa
alignasaaa
alignasaaaa
alignasaaaaa
alignasaaaaaa
alignasaaaaaaa
*/



