main(n){scanf("%d",&n);printf("%d",2017-n);}