long n;f(a,b,c,d){n--%4912?f(b,c,d%17,a+b+c+d):printf("%d\n",a);}main(i){for(;~scanf("%ld",&n);--i&&f(1,0,0,0));}