/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com5
 * Date: 2013.10.05
 *
 * Status: TL 24, Time > 5
 */

#include <cstdio>
#include <cassert>

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

const int N = (int)1e5;

int n, is[N + 1];

int prime( int i )
{
  if (i < 2)
    return 0;
  for (int j = 2; j * j <= i; j++)
    if (i % j == 0)
      return 0;
  return 1;
}

int main()
{
  #define NAME "fourprimes"
  assert(freopen(NAME ".in", "r", stdin));
  assert(freopen(NAME ".out", "w", stdout));

  assert(scanf("%d", &n) == 1 && n <= N);
  forn(i, n + 1)
    is[i] = prime(i);
  
  int cnt = 0;
  forn(a, n + 1) if (is[a])
    forn(b, n + 1) if (is[b])
      forn(c, n + 1) if (is[c])
        forn(d, n + 1) if (is[d])
          if (a + b + c + d == n)
            cnt++;
  printf("%d\n", cnt);
  return 0;
}
