#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#define int long long
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(0),cin.tie(0);
    string k;
    cin>>k;
    reverse(k.begin(),k.end());
    int i=0;
    while(k[i]=='0'){
        i++;
    }
    for(;i<k.size();i++){
        if(k[i]=='2'){
            cout<<5;
            continue;
        }
        if(k[i]=='5'){
            cout<<2;
            continue;
        }
        cout<<k[i];
    }
}