#include <bits/stdc++.h>
#define ll long long
#define int ll
#define itn int
#define sz(x) (x).size() 
#define all(x) (x).begin(), (x).end() 
#define pb push_back 
#define sonic ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//const int MAX=2e17+5;
//const int abi=1e6+5;
using namespace std;  
int n,t=1;
void x( ){
    string s,s1="";
    cin>>s;
    for(int i=0;i<sz(s);i++){
        if(s[i]=='2')s1+='5';
        else if(s[i]=='5')s1+='2';
        else s1+=s[i];
    } reverse(all(s1));
    while(s1[0]=='0')s1.erase(s1.begin());
    cout<<s1;
}signed main(){sonic 
    //cin>>t; 
    while(t--){ 
    x();
    }
    return 0; 
}