#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
#pragma GCC optimize ("unroll-loops,Ofast,O3")
#pragma GCC target("avx,avx2,fma")

#define file(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define deb(x) cerr << #x  << " = " << x << endl;
#define all(x) (x).begin(),(x).end()
#define int long long
#define ar array
#define rs(p) (p<<1|1)
#define ls(p) (p<<1)
#define pb push_back
#define endl '\n'
#define sz size()
#define F first
#define S second
#define IOIG ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const long double eps = 1e-10;
const int MIN = LLONG_MIN;
const int M = 1e9 + 7;
const int N = 2e5 + 23;
void solve() {
  string s;
  cin >> s;
  reverse(all(s));
  bool ok = 1;
  for(int i = 0; i < s.sz; ++i) {
    if(s[i] == '0' && ok) {
      continue;
    } 
    ok = 0;
    if(s[i] == '2') cout << '5' ;
    else if(s[i] == '5') cout << '2';
    else cout << s[i];
  }
}
signed main () {
  IOIG
  int test = 1;
  // cin >> test;
    while(test--) {
      solve();
  }
}
