// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
    string a;
    cin >> a;
    while (a[a.size()-1]=='0') {
        a.pop_back();
    }
    for (int i=a.size()-1;i>=0;i--) {
        if (a[i]=='2') {
            a[i]='5';
        } else if (a[i]=='5') {
            a[i]='2';
        }
        cout << a[i];
    }
}