#include<bits/stdc++.h>
#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
using namespace std;
#define int long long
signed main() { 
    ios_base::sync_with_stdio(false);    
    cin.tie(nullptr);
    string s;
    cin>>s;
    string ans = "";
    bool ok = 0;
    for(int i = s.size() - 1; i >= 0; i--) {
        if(!ok && s[i] == '0')continue;
        ok = 1;
        if(s[i] == '2')ans += '5';
        else if(s[i] == '5')ans += '2';
        else ans += s[i];
    }
    cout << ans << '\n';
}

