

#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define sz(s) (int)s.size()
#define in insert
#define pii pair<int, int>
#define pb push_back

int a[10][10];
int dx[8]={0,1,0,-1,1,-1,1,-1};
int dy[8]={1,0,-1,0,1,1,-1,-1};
vector<pii> v;
int use[10][10];
int cnt[5];

bool good(int x){
    return (0<=x&&x<10);
}

void dfs(int x,int y){
    use[x][y]=1;
    v.pb({x,y});
    for(int i=0;i<8;i++){
        int nx=dx[i]+x;
        int ny=dy[i]+y;
        if(good(nx)&&good(ny)&&a[nx][ny]&&!use[nx][ny])dfs(nx,ny);
    }
}

int main(){
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    int good = 0;
    for(int i = 0; i < s.size(); ++i){
        if(!good && s[i] == '0') continue;
        if(s[i] != '0'){
            good = 1;
        }

        if(s[i] == '2'){
            cout << '5';
        } else if(s[i] == '5'){
            cout << '2';
        } else {
            cout << s[i];
        }
    }
}