#include<bits/stdc++.h>
#define int int64_t
using namespace std;
int32_t main(){
    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif // LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    reverse(s.begin(),s.end());
    for(int i = 0 ; i < s.size(); ++ i){
        if(s[i] == '2')s[i] = '5';
        else if(s[i] == '5')s[i] = '2';
    }
    int l = 0 ;
    while(s[l] == '0' && l < s.size())l ++ ;
    for(int i = l; i < s.size(); ++ i){
        cout << s[i];
    }
    return 0;
}
