#include
using namespace std;
int replaced0with5(int N){
int rev=0,reva=0,r;
while(N>0){
r=N%10;
if(r==0){
r=5;
}
rev = rev*10+r;
N=N/10;
}
while(rev>0){
r=rev%10;
reva=reva*10+r;
rev=rev/10;
}
return reva;
}
int main() {
int hN;
cin>>hN;
cout<<replaced0with5(hN);
return 0;
}