//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization("unroll-loops") 


//#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include<stack>
#include<string>
#include<string.h>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>


#define ll long long
#define boost ios_base::sync_with_stdio(NULL);cin.tie(0);cout.tie(0)
using namespace std;


int main()
{
 //freopen("input.txt", "r", stdin);
    ///freopen("output.txt", "w", stdout);
 boost;
    string s;
    cin >> s;
    
    string ss = "";
    
    ll r = s.size();
    if(s[r - 1] == '0')
    {
        r--;
    }
    
    for(int i = r - 1;i >= 0; i--)
    {
        if(s[i] == '2')
        ss+= '5';
        else if(s[i] == '5')
        ss+= '2';
        else
        ss+=s[i];
    }
    cout << ss << endl;
 
}