
#include <bits/stdc++.h>

using namespace std;

int main()
{
    string n;
    cin >> n;
    for(int i = n.size()-1;i>-1;i--)
    {
        if(n[i]=='0') continue;
        if(n[i]=='2') {cout << 5;continue;}
        if(n[i]=='5') {cout << 2;continue;}
        cout << n[i];
    }
    return 0;
}

