#include<bits/stdc++.h>

using namespace std;
using ll = long long;



int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    for(int i = 0; i < (int)s.size(); i++) {
        if(s[i] == '2') s[i] = '5';
        else if(s[i] == '5') s[i] = '2';
    }
    while(s.size() > 1 && s[0] == '0') s.erase(0, 1);
    cout << s;
}
