#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main(){	
	vector <ll> a;
	ll n;
	cin>>n;
	while (n != 0){
		a.push_back(n % 10);
		n /= 10;
	}
	for (int i = 0; i< a.size(); i++){
		if (i == 0 and a [i] == 0){
			continue;
		}
		if (a[i]==2){
			a[i]=5;
			cout<<a[i];
			continue;
		}
		if (a[i]==5){
			a[i] = 2;
		}
		cout<<a[i];
		
	}
}

