#include <bits/stdc++.h>
using namespace std;

#define int long long
#define vi vector <int>
#define speed ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

vi g[101]; bool used[101];

void dfs(int v){
	used[v] = true;
	for (auto i : g[v]){
		if (!used[i]){
			dfs(i);
		}
	}
}

signed main(){
//	freopen("complete.in", "r", stdin);
//	freopen("complete.out", "w", stdout);
	speed; string s;
	cin >> s;
	for (int i = s.size(); i >= 0; --i){
		if (s[i] == '5') cout << "2";
		else if (s[i] == '2') cout << "5";
		else {
		if (s[i] != '0') cout << s[i];
		}
	}
}
