#include <bits/stdc++.h>
#define ll long long
#define f first
#define s sceond
using namespace std;

int main()
{
    string s;
    cin >> s;
    string t="";
      reverse(s.begin(),s.end());
      int shet=0;
   for (int i=0;i<s.size();i++) {
       if (s[i]=='0' && shet==0) {
            continue;
       }shet++;
       if (s[i]=='2') {
           cout << '5';
           continue;
       } else if (s[i]=='5') {
            cout << '2';
            continue;
       } cout << s[i];
       
   } 
 
      
    return 0;
}