#include <cstdio>
#include <set>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

constexpr int MAX_Q = 100000;

using ll = long long;

const ll dx[4] = { 0, 1, 0, -1 }, dy[4] = { -1, 0, 1, 0 };

ll n, m, q;
std::set<ll> a;
bool fld[2000000][7];

void dfs( ll v, ll h )
{
  ll i = v/7, j = v%7;

  fld[i][j] = true;

  rep( d, 4 )
  {
    ll ni = i+dy[d], nj = j+dx[d];

    if( ni >= 0 && ni < h && nj >= 0 && nj < 7 && !fld[ni][nj] )
      dfs( ni*7+nj, h );
  }

  return;
}

int main()
{
  scanf( "%lld%lld%lld", &n, &m, &q );
  rep( i, q )
  {
    ll x;
    scanf( "%lld", &x );

    a.insert( x );
  }

  ll k = m%7==0 ? 1 : 7;

  rep( i, k*m )
    fld[i/7][i%7] = a.find( i%m )!=a.end();

  ll cnt = 0;
  rep( i, k*m ) if( !fld[i/7][i%7] )
    dfs( i, k*m/7 ), ++cnt;

  rep( i, 2*k*m )
    fld[i/7][i%7] = a.find( i%m )!=a.end();

  ll cnt2 = 0;
  rep( i, 2*k*m ) if( !fld[i/7][i%7] )
    dfs( i, 2*k*m/7 ), ++cnt2;
  
  ll a, b;
  
  // cnt (7a)*1+b
  // cnt2 (7ia)*2+b
  a = cnt2-cnt, b = cnt-a;

  printf( "%lld\n", a*7*n/m/k+b );

  return 0;
}