#include
using namespace std;
int reverse(int temp){
int ans=0;
while(temp>0){
int rem = temp%10;
ans = ans*10 + rem;
temp = temp/10;
}
return ans;
}
int replace(long long int n){
if(n == 0){
return 5;
}
else{
int x=0;
int temp=0;
while(n>0){
x = n%10;
if(x == 0){
x = 5;
}
temp = temp*10 + x;
n=n/10;
}
return reverse(temp);
}
}
int main()
{
long long int n;
cin>>n;
if(n<0){
n=n*(-1);
cout << -1*(replace(n));
}
else{
cout << replace(n);
}
return 0;
}