// By ObeliX
#include <bits/stdc++.h>
#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#include <unordered_map>
#include <cstddef>
#include <cassert>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>

using namespace std;
const long long INF = 1e18;
const long long mod = 998244353;
const long long N = 1e6;
const long long M = 1ll << 32 ;
const double eps = 1e-6;
string alph = "abcdefghijklmnopqrstuvwxyz";
// ||

string s;

int main(){
    //freopen( "cinema.in" , "r" , stdin );
    //freopen( "cinema.out" , "w" , stdout );
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> s;
    long long pos = 0;
    for ( int i = s.size() - 1 ; i >= 0 ; i-- ) {
        if ( s[i] == '0' ) {
            if ( pos == 0 ) {
                continue;
            }
            else {
                cout << s[i];
            }
        }
        else {
            if ( s[i] == '5' ) {
                cout << '2';
            }
            else if ( s[i] == '2' ) {
                cout << '5';
            }
            else {
                cout << s[i];
            }
            pos = 1;
        }
    }
}
