#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL)
#define ll long long  
#define ull unsigned long long
#define pb push_back
#define endl "\n"
#define int ll  
#define F first
#define S second
using namespace std;
const int inf = 1e9;
void solve() {   
    string a;
    cin>>a;
    reverse(a.begin(),a.end());
    bool flag=0;
    for(int i=0;i<a.size();i++){
        if(a[i]=='0'&&flag==0){
            continue;
        }
        flag=1;
        if(a[i]=='2'){
            cout<<'5';
        }
        else if(a[i]=='5'){
            cout<<'2';        }
        else{
            cout<<a[i];
        }
    }
}
//8 2 4 1
signed main() { 
    IOS;
    int UwU = 1;
    //cin >> UwU;
    while (UwU--) {
        solve();
    }   
}