/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;
    bool b = false;
    int n = s.size();
    for(int i = n - 1;i >= 0;i--){
        if(s[i] != '0'){
            b = true;
        }
        if(b){
            if(s[i] == '2'){
                cout << "5";
            }else if(s[i] == '5'){
                cout << "2";
            }else{
                cout << s[i];
            }
            
        }
    }
    return 0;
}