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