#include <bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
    int n;
    string s;
    cin >> s;
    reverse(s.begin() , s.end());
    while(s[0] == '0'){
        s.erase(s.begin());
    }
    for(int i = 0; i < s.size(); i++){

        if(s[i] == '2'){
            s[i] = '5';
        }

        else if(s[i] == '5'){
            s[i] = '2';
        }
    }
    cout << s;
}
main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int t=1;
    while(t--)solve();
}
