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