#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define pb push_back
#define ss second
#define ff first
#define vt vector
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
const ll inf = 1e16;
const int mod = 1e9+7;
const int maxn = 2e5 + 12;
void solve() {
	string s;
	cin >> s;
	reverse(all(s));
	bool ok = 1;
	int n = s.size();
	for(int i = 0; i < n; i++) {
		if(s[i] == '0' && ok)continue;
		ok = 0;
		if(s[i] == '2')s[i] = '5';
		else if(s[i] == '5')s[i] = '2';
		cout << s[i];
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int times = 1;
	//cin >> times;
	for(int i = 1; i <= times; i++) {
		solve();
	}
	return 0;
}
