#include <bits/stdc++.h>

#define ll long long

using namespace std;

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

