#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,g,s,b,h,a,f,c,d,m;
	cin>>x;
	g=x%10;
	s=x/10%10;
	b=x/100;
	h=x/1000;
	a=(g+5)%10;
	f=(s+5)%10;
	c=(b+5)%10;
	d=(h+5)%10;
	m=a*1000+f*100+c*10+d;
	cout<<m;
}




/**************************************************************
	Problem: 1109
	User: chensijia
	Language: C++
	Result: Accepted
	Time:9 ms
	Memory:2072 kb
****************************************************************/