long n,i=2014,k=2800;main(s){scanf("%ld",&n);n-=i;s=n/k*399;for(n=n%k+i;i++0|i%400<1;k=!printf("%d",s);}