#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
template<class T> istream& operator>>(istream& is, vector<T>& arr) { for(auto& i:arr) is>>i; return is;}
template<class T> ostream& operator<<(ostream& os, vector<T>& arr) { for(auto& i:arr) os<<i<<" "; return os;}


ll rec(ll w,ll h){
ll s = w*h;
if(w<h) swap(w,h);
if(w==1) return s;
return s+rec(w/2,h)+rec(w-w/2,h);
}
/// 2^log(w) = w
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);

string s;
cin>>s;


reverse(all(s));


for(auto &i:s)
{
if(i==2+'0') i=5+'0';
else if(i==5+'0') i=2+'0';
}
ll t = stoi(s);

cout<<t<<endl;


return 0;
}
