/*
	Created ny exypn0x
	28.08.2023
	nisfmn.contest.codeforces.com [day 5]
*/
 
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define pb push_back
#define pp pop_back
#define bg begin
#define vll vector<long long>
#define fi first
#define sc second
#define vc vector<char>
#define pi pair<int,int>
#define pic pair<int,char>
#define ull unsigned long long
#define vull vector<unsigned long long>
#define uint unsigned int
#define pb push_back
#define pp pop_back

#define speed ios_base::sync_with_stdio(0);cin.tie(NULL);
using namespace std;

void solve() {
	speed;
	std::string str;
	cin>>str;
	reverse(str.begin(),str.end());
	bool a = false;
	for (int i = 0;i<str.size();i++) {
	    if (str[i] == '0' and !a)
	    {
	        continue;
	    }
	    if(str[i] == '5') {cout<<"2";a=true;continue;}
	    if(str[i] == '2') {cout<<"5";a=true;continue;}
	    cout<<str[i];a=true;
	}
}

int main() {
	solve();
	return 0;
}
