#include<bits/stdc++.h>
using namespace std;
int main(){
int x,g,s,b,q,h=0;
cin>>x;
g=x%10;
s=x/10%10;
b=x/100%10;
q=x/1000;
g=(g+5)%10;
s=(s+5)%10;
b=(b+5)%10;
q=(q+5)%10;
h=g*1000+s*100+b*10+q;
cout<<h;
return 0;
}
/**************************************************************
Problem: 1109
User: zhangchenhao
Language: C++
Result: Accepted
Time:14 ms
Memory:2072 kb
****************************************************************/