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

#define Bekabot ios_base::sync_with_stdio(NULL);cin.tie(0);cout.tie(0);
#define fopen(s) freopen(s".in","r",stdin);freopen(s".out","w",stdout)
#define all(x) (x).begin(), (x).end()
#define len(x) (int)x.size()
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define elif else if
#define F first
#define S second
#define int long long
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(all(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(all(v),x)-v.begin())

const int N = 1e5 + 78 , inf = 1e18 , M = 1e9 + 7;
using namespace std;

string trans(int n , int k){
    string s = "";
    while(n != 0){
        int d = n % k;
        if(d < 10){
            s = to_string(d) + s;
        }
        else{
            s = char(d + 'A' - 10) + s;
        }
        n /= k;
    }
    return s;
}

void skibidi_dop_dop_dop_yes_yes(){
	string s;
	cin >> s;
	reverse(all(s));
	for(int i = 0 ; i < len(s) ; i++){
		if(s[i] == '2')s[i] = '5';
		else if(s[i] == '5')s[i] = '2';
	}
	while(s[0] == '0' and len(s) > 1)s.erase(s.begin());
	cout << s;
}

signed main(){
    Bekabot
    int t = 1;
    //cin >> t;
    while(t--){
		skibidi_dop_dop_dop_yes_yes();
	}
}