#include <bits/stdc++.h>
#define CODE_HERE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
typedef long long ll;
using namespace std;
void solve()
{ 
    string s;
    cin >>s;
    while(s.back() == '0')
        s.erase(s.size() - 1, 1);
    for(int i = s.size() - 1; i >= 0; i--)
    {
        if(s[i] == '2')
            cout <<5;
        else if(s[i] == '5')
            cout <<2;
        else
            cout <<s[i];
    }
}
int main()
{
    CODE_HERE;
    int t;
    for (t = 1; t > 0; t--) solve();
}