#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    ll n;
    cin >> n;
    vector<int> k;
    while(n > 0){
        int t = n % 10;
        if(t == 2){
            k.push_back(5);
        }else if(t == 5){
            k.push_back(2);
        }else if(t == 0){
        }else{
            k.push_back(t);
        }
        n = (n - (n % 10)) / 10;
    }
    for(auto i : k){
        cout << i;
    }
}
