#include <stdio.h>
int main()
{
	int Y;
	scanf("%d", &Y);
	printf("%d", 2017 - Y);

	return 0;
}