#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;

int main() {
	long long k;
	string ans;
	cin >> k;
	while (k % 10 == 0) { k /= 10; }
	while (k > 0) {
		int l = k % 10;
		if (l == 2) { l = 5; }
		else if (l == 5) { l = 2; }
		string t = to_string(l);
		ans = ans + t;
		k /= 10;
	}
	cout << ans;
}