#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>

using namespace std;
using ll = long long;
using ld = long double;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    int n = s.size();
    int i = 0;
    string ans = "";
    while (s[i] == '0') {
        i++;
    }
    while (i < n) {
        if (s[i] == '2') {
            ans += '5';
        } else if (s[i] == '5') {
            ans += '2';
        } else {
            ans += s[i];
        }
        i++;
    }
    cout << ans;
}

