#include <bits/stdc++.h>
#define endl '\n'
#define int ll
#define ve vector
#define pb push_back


using namespace std;
typedef long long ll;

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt" , "r" , stdin);
        freopen("output.txt" , "w" , stdout);
    #endif // LOCAL

    string s;
    cin >> s;

    reverse(s.begin(), s.end());

    int it = 0;
    while(s[it] == '0') it++;

    string ans = "";

    for(int i = it; i < (int)(s.size()); i++)
        if(s[i] == '5') ans += '2';
    else if(s[i] == '2') ans += '5';
    else ans += s[i];

    cout << ans;

    return 0;

}
