#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <random>
#include <numeric>
#include <map>
#include <set>
#include <string>

using namespace std;
using ll = long long;
using ld = long double;

#define deb(x) cerr << #x << ":\t" << x << '\n';
#define len(x) (ll) x.size()

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

void solve() {
    string s; cin >> s;
    vector<ll>pw(19);
    pw[0] = 0;
    for (int i = 1; i < 19; i++) {
        pw[i] = 10 * pw[i - 1];
    }
    for (int i = 0; i < (int)s.size(); i++) {
        if (s[i] == '2') {
            s[i] = '5';
        } else if (s[i] == '5') {
            s[i] = '2';
        }
    }
    ll ans = 0;
    while ((int)s.size() > 0) {
        ans = ans * 10 + (s.back() - '0');
        s.pop_back();
    }
    cout << ans;
}

int main() {
    int T = 1;
//    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}
