#include<iostream>
#include<vector>
#include<string>	
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<cstdio>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll gcd(ll a, ll b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

//=================================

void solve() {
	string s;
	cin >> s;
	reverse(all(s));
	for (ll i = 0; i < s.size(); ++i) {
		if (s[i] == '5') s[i] = '2';
		else if (s[i] == '2') s[i] = '5';
	}
	for (ll i = 0; i < s.size(); ++i) {
		if (s[i] == '0' && i == 0) {

		}
		else {
			cout << s[i];
		}
	}
}

//=================================

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int tt = 1;
	//cin >> tt;
	while (tt--) {
		solve();
		cout << '\n';
	}
	return 0;
}