#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,g,s,b,q,y=0;
	scanf("%d",&x);
	g=x%1000;
	g=(5+g)%10;
	s=x/10%10;
	s=(5+s)%10;
	b=x/100%100;
	b=(5+b)%10;
	q=x/1000;
	q=(5+q)%10;
	y=g*1000+s*100+b*10+q*1;
	printf("%d",y);
	return 0;
}

/**************************************************************
	Problem: 1109
	User: xiaojingxuan
	Language: C
	Result: Compile Error
****************************************************************/