#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pb push_back
#define ent "\n"

const int N = 1e5 + 112;
const int inf = (ll)1e9;
const int maxl = 26;
const int MOD = 1e9 + 7;

string s;

void test(){
      cin >> s;
      reverse(s.begin(), s.end());
      for(int i = 0; i < s.size(); i++){
            if(s[i] == '0') continue;
            else if(s[i] == '5') cout << 2;
            else if(s[i] == '2') cout << 5;
            else cout << s[i];
      }
} 

int main(){
    //freopen (".in", "r", stdin);
    //freopen (".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t = 1; //cin >> t;
    while(t--) test();
}
