#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <deque>
#include <ctime>
#include <random>

#define int long long
#define ld long double
#define endl '\n'
#define fi first
#define se second
#define p_b push_back

using namespace std;

const int inf = 1e9 + 7;

main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    string k;
    while(n>0)
    {
        k+=n%10+'0';
        n/=10;
    }

    string ans;
    for (int i = 0; i < k.size(); i++){
        if (k[i] == '0' && ans.empty()) continue;
        else if (k[i] == '2') ans+='5';
        else if (k[i] == '5') ans+='2';
        else ans+=k[i];
    }
    cout << ans;

    return 0;
}
