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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	int n = s.size();
	int fl = 0;
	for(int i = n - 1; ~i; i--) {
		if(s[i] == '0') {
			if(fl) cout << 0;
			continue;
		}
		fl = 1;
		if(s[i] == '5') cout << 2;
		else if(s[i] == '2') cout << 5;
		else cout << s[i];
	}
}
