#include <bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin >> a;
    reverse(a.begin(),a.end());
    for(int i = 0; i < a.size(); i++){
        if(a[i] == '2'){
            a[i] = '5';
        }else{
            if(a[i] == '5'){
                a[i] = '2';
            }
        }
        
    }
    int counter = 0;
    for(int i = 0; i < a.size(); i++){
        if(a[i] == '0'){
            counter++;
        }else{
            break;
        }
    }
    for(int i = counter; i < a.size(); i++){
        cout << a[i];
    }
}
