#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <fstream>
#include <algorithm>
#include <stack>
#include <deque>
#include <iomanip>
#include <queue>
#include <sstream>


using namespace std;


#define int long long
#define ull unsigned long long

int mod = 998244353;


int fact(int n){
    int f = 1;
    for(int i = 1; i < n; i++){
        f = (f * (i + 1)) % mod;
    }
    return f;
}

void HeapSort(vector<int>& values) {
    make_heap(values.begin(), values.end());
    for (auto i = values.end(); i != values.begin(); --i) {
        pop_heap(values.begin(), i);
    }
}

int bp(int a, int m){
    if(m == 1)return a;
    if(m % 2) return (a *bp(a, m - 1)) % mod;
    int t = bp(a, m / 2);
    return (t * t) % mod;
}

vector<int> er(int n, vector<int> &g){
    vector<int> val;
    int v = n;
    while(v != 1){
        if(val.empty() || val[val.size() - 1] != g[v]){
            val.push_back(g[v]);
        }
        v = v / g[v];
    }
    return val;
}


struct edg{
    int v, u, w;
};


signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    int i = 0;
    while(s[i] == '0'){
        i++;
    }
    while(i < s.size()){
        if(s[i] == '5'){
            cout << '2';
        }
        else if(s[i] == '2'){
            cout << '5';
        }
        else{
            cout << s[i];
        }
        i++;
    }
    return 0;
}
