#include <bits/stdc++.h>
#define int long long
#define ll long long
#define str string
#define ld long double
#define run_vasya_run ios_base::sync_with_stdio(0) , cin.tie(0) ,cout.tie(0)
#define uint unsigned long long
#define fi first
#define se second
#define pb push_back
#define open freopen ("log.in", "r", stdin);
#define close freopen("log.out", "w", stdout);
using namespace std;
const int MOD = 10000000007;
str s , s1;
ll kol , _;
main()
{
    //run_vasya_run;
    _ = 1;
    //open;
    //close;
    //cin >> _;
    while(_ --)
    {
        cin >> s;
        kol = 0;
        for(int i = s.size() - 1;i >= 0;i --)
        {
            if(s[i] == '0' && kol == 0)
            {
                continue;
            }
            kol = 1;
            if(s[i] == '2')
            {
                s1 += '5';
            }
            else if(s[i] == '5')
            {
                s1 += '2';
            }
            else{
                s1 += s[i];
            }
        }
        cout << s1;
    }
}
