#include<stdio.h> int main() { int n; scanf("%d",&n); int a,b,c,d; a=(n%10+9)%10;//个 n=n/10; b=(n%10+9)%10;//十 n=n/10; c=(n%10+9)%10;//百 d=(n/10+9)%10;//千 printf("%d",1000*b+100*a+10*d+c); return 0; }