#include <bits/stdc++.h>

using namespace std;

#define int long long
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define sz(x)(int) x.size()
#define ins insert
#define speed ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define pf push_front
#define pb push_back
#define all(x) x.begin(), x.end()
#define pii pair < int, int >
#define pll pair < ll, ll >
#define vi vector < int >
#define vll vector < long long >
#define vpii vector < pair < int, int >>
#define vpll vector < pair < long long, long long >>
#define mem memset
#define debug cerr << "OK\n";

mt19937 bruh(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rofl(chrono::steady_clock::now().time_since_epoch().count());

const int inf = 1e9;
const ll INF = (ll)1e18;
const ll INF1 = (ll)1e14 + 1;
const int N = (int)5e5 + 5;
const int MAT = 2005;
const ll mod = (ll)1e9 + 7;
const ll mod1 = (ll)1e9 + 9;
const ll MAX = (ll)15000000 + 5;
const int P = 31;
const int K = 17;

ll binpow(ll a, ll n) {
    if (n == 0) return 1;
    if (n == 1) return (a) % mod;
    ll r = binpow(a, n / 2) % mod;
    if (n & 1) return (((r * r) % mod) * a) % mod;
    return (r * r) % mod;
}

void setIO(string s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}

int dx[4] = {
    0,
    -1,
    0,
    1
};

int dy[4] = {
    1,
    0,
    -1,
    0
};

ll add(ll a, ll b) {
    return (((a + b) % mod) + mod) % mod;
}

ll mul(ll a, ll b) {
    return (a * b) % mod;
}

map<int, int> c; 

void yela() {
    string s;
    cin >> s;
    string ans = "";
    for (int i = sz(s) - 1; i >= 0; --i) {
        if (s[i] == '5') {
            ans += '2';
            continue;
        } else if (s[i] == '2'){
            ans += '5';
            continue;
        }
        ans += s[i];
    }
    cout << stoll(ans) << "\n";
}

signed main() {
    speed;
    int T = 1;
    //cin >> T;
    for (int i = 1; i <= T; i++) {
        yela();
    }
    #ifdef ONPC
        cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
    return 0;
}