#include <bits/stdc++.h>
using namespace std;
int main(){
int x,a,b,c,d,e,f,g,h,i;
cin>>x;
a=x%10;
b=x/10%10;
c=x/100%10;
d=x/1000;
e=(a+5)%10;
f=(b+5)%10;
g=(c+5)%10;
h=(d+5)%10;
i=e*1000+f*100+g*10+h;
cout<<i;
}
/**************************************************************
Problem: 1109
User: zhuangwenya
Language: C++
Result: Accepted
Time:9 ms
Memory:2072 kb
****************************************************************/