/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com5
 * Date: 2013.10.05
 *
 * Status: Accepted, Time = 4.0
 */

#include <cstdio>
#include <cassert>
#include <iostream>

using namespace std;

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

typedef long long ll;

const int N = (int)1e5;
const int PN = (int)2e4;

int n, pn, p[PN];
ll c[N + 1];
char is[N];

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);

  for (int i = 2; i < n; i++)
    if (!is[i])
    {
      assert(pn < PN);
      p[pn++] = i;
      for (int j = i + i; j < n; j += i)
        is[j] = 1;
    }
  c[0] = 1;
  forn(t, 4)
    for (int i = n; i >= 0; i--)
      if (c[i])
      {
        for (int j = 0; j < pn && i + p[j] <= n; j++)
          c[i + p[j]] += c[i];
        c[i] = 0;
      }

  cout << c[n] << endl;
  return 0;
}
