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