//
// EXPERT
// 
 
#include <bits/stdc++.h>
 
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
 
typedef long double ld;
typedef long long ll;
  
using namespace std;
  
ll gcd (ll a, ll b) {
	while (b) {
		a %= b;
		swap (a, b);
	}
	return a;
}
  
const ll N = 2e5 + 7;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ld pi = 3.141592653589793;
const ld eps = 1e-12;
const ll zero = 0;
const int A = 1e7 + 7;
  
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};
  
void solve() {
    string s;
    cin >> s;
    reverse(all(s));
    int cnt = 0;
    while (s[cnt] == '0') cnt++;
    s = s.substr(cnt);
    for (int i = 0; i < sz(s); i++) {
        if (s[i] == '5') s[i] = '2';
        else if (s[i] == '2') s[i] = '5';
    }
    cout << s;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // freopen("B.in","r",stdin);
    // freopen("B.out","w",stdout);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
