#include <iostream>
#include <string>
using namespace std;

int main() {
    string k;
    cin >> k;
    int a = 1;
    for (int i = k.length() - 1; i >= 0; i--) {
        if (k[i] == '0' && i == k.length() - 1) {
            a++;
        } else if (k[i] == '0' && a != 0) {
        } else if (k[i] == '0' && a == 0) {
            cout << '0';
        } else if (k[i] == '2') {
            cout << '5';
            a = 0;
        } else if (k[i] == '5') {
            cout << '2';
            a = 0;
        } else {
            a = 0;
            cout << k[i];
        }
    }
    return 0;
}
