
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#include <bits/stdc++.h>
using namespace std;

int main ()
{
  IOS;
  string k;
  cin >> k;
  reverse (k.begin(), k.end());
  unsigned long long j = 0;
  while(k[j] == '0'){
      k.erase(j, 1);
      j++;
  }
  for (unsigned long long i = 0; i < k.size (); i++){
      if(k[i] == '5') cout << '2';
      else if(k[i] == '2') cout << '5';
      else cout << k[i];
  }
}
