#include int main(){ int Y; scanf("%d", &Y); printf("%d\n", 2017-Y); return 0; }