/*
It is code Zhanabergen Abdurroshid :))))
*/
#include<bits/stdc++.h>
#define ll long long
#define int ll
#define m_p make_pair
#define p_b push_back
#define pii pair<int,int>
#define piii pair<int,pii>
#define vi vector<ll>
#define vii vector<pii>
#define viii vector<pair<int,pii> >
#define si set<int>
#define sii multiset<pii>
#define siii set<pair<int,pii> >
#define F first
#define S second
#define pre precision
#define n_per next_permutation
#define sz size()
#define all(x) x.begin(),x.end()
#define RUN ios_base::sync_with_stdio(false);cin.tie(0);
#define OPEN freopen("rmq.in","r",stdin);freopen("rmq.out","w",stdout)
using namespace std;
ll fl(){
	ll a;
	cin>>a;
	return a;
}
const ll N = 7e6 + 9;
const ll INF = 1e18 + 9, MOD = 1e9 + 7;
main(){
	RUN;
	//OPEN;
	string s;
	cin>>s;
	while(s.sz&&s[s.sz-1]=='0')s.erase(s.begin()+s.sz-1);
	reverse(all(s));
	for(int i=0;i<s.sz;i++){
		if(s[i]=='2')cout<<5;
		else if(s[i]=='5')cout<<2;
		else cout<<s[i];
	}
	return 0;
}
