#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll i, cnt1 = 0, cnt2 = 0;
    string s;
    cin >> s;
    ll m = s.size();
    for (i = m - 1; i >= 0; i --){
         if (s[i] == '2' and cnt1 == 0){
            cout << 5; cnt1 ++;
         }
         else if (s[i] == '5' and cnt2 == 0){
            cout << 2; cnt2 ++;
         }
         else if (s[i] == '0' and (i == m - 1 or i == 0)){
            continue;
         }
         cout << s[i];
    }
}
