// https://omegaup.com/arena/problem/angulos-2a-ccp
#include <stdio.h>

int main( ) {
   int n;
   scanf("%d", &n);
   printf("%d", n % 360);
   return 0;
}
