//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define ent "\n"
#define int long long
#define f first
#define s second

const int maxn = 1e6 + 100;
const int inf = (int)1e9 + 100;
const ll INF = (ll)1e18;
const int MOD = 1e9 + 7;
const int maxl = 20;
const ll P = 31;

int a, b;
string s;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin >> s;
    vector<char>ans;
    for(auto to: s){
        if(to == '2') ans.push_back('5');
        else if(to == '5') ans.push_back('2');
        else ans.push_back(to);
    }
    while(ans.size() > 1 && ans.back() == '0') ans.pop_back();
    reverse(ans.begin(), ans.end());
    for(auto to: ans) cout << to;
}
