#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define S second
#define F first
#define ull unsigned long long

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s, s1 = "";
    cin >> s;

    for(int i = s.size() - 1; i >= 0; i--){
        if(s[i] == '0' && i == s.size() - 1) continue;
        else if(s[i] == '2') s1 += '5';
        else if(s[i] == '5') s1 += '2';
        else s1 += s[i];
    }
    cout << s1;
    return 0;
}
