#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define str string
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define optimizator ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define sz size

int main(){
	// freopen (" .txt", "r", stdin);
	// freopen (" .txt", "w", stdout);
	optimizator;
	string s;
	cin >> s;
	bool zeros = 1;
	for(int i = s.size() - 1; i >= 0; i --){
	if(zeros && s[i] == '0'){
		continue;
	}
	else if(zeros && s[i] != '0'){
		zeros = 0;
	}
	if(s[i] == '2') cout << '5';
	else if(s[i] == '5') cout << '2';
	else cout << s[i];
	}
}
/*
/effect @s always_green 999999 255 true
/give @s correct_code 512
/give @s hugs 64
*/

