#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 200005;
const ld PI = 4*atan((ld)1);

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

namespace input {
    template<class T> void re(complex<T>& x);
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    void re(ld& x) { string t; re(t); x = stold(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) { 
        re(first); re(rest...); 
    }

    template<class T> void re(complex<T>& x) { T a,b; re(a,b); x = cd(a,b); }
    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}

using namespace input;

namespace output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) { 
        pr(first); pr(rest...); 
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
        pr("{",x.f,", ",x.s,"}"); 
    }
    template<class T> void prContain(const T& x) {
        pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; // const needed for vector<bool>
        pr("}");
    }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }
    
    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) { 
        pr(first); ps(); // no space at end of line
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) { 
        pr(first," "); ps(rest...); // print w/ spaces
    }
}

using namespace output;

namespace io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0); // fast I/O
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
    }
}

using namespace io;

ll n,m,q;
bitset<100000> ok;

template<int SZ> struct DSU {
    int par[SZ], sz[SZ];

    DSU() {
        F0R(i,SZ) par[i] = i, sz[i] = 1;
    }

    int get(int x) { // path compression
    	if (par[x] != x) par[x] = get(par[x]);
    	return par[x];
    }

    bool unite(int x, int y) { // union-by-rank
    	x = get(x), y = get(y);
    	if (x == y) return 0;
    	if (sz[x] < sz[y]) swap(x,y);
    	sz[x] += sz[y], par[y] = x;
    	return 1;
    }
};

DSU<700000> D;
ll tot = 0;
int rows;

void tri(int a, int b) {
	if (ok[a%m] && ok[b%m]) tot -= D.unite(a,b);
}

int get(int x) {
	if (!ok[x%m]) return -1;
	return D.get(x);
}

pair<int,vi> unite(vi b, vi A, vi B) {
	map<int,int> m;
	trav(t,b) if (t != -1) t += MOD;
	trav(t,b) m[t] = 0;
	trav(t,A) m[t] = 0;
	trav(t,B) m[t] = 0;
	m.erase(-1);
	int co = 0;
	trav(t,m) t.s = co++;
	trav(t,b) if (t != -1) t = m[t];
	trav(t,A) if (t != -1) t = m[t];
	trav(t,B) if (t != -1) t = m[t];
	// ps(b,A,B);
	DSU<21> Z = DSU<21>();
	
	int ret = 0;
	F0R(i,7) if (b[i] != -1 && A[i] != -1) ret += Z.unite(b[i],A[i]);
	F0R(i,7) if (B[i] != -1) B[i] = Z.get(B[i]);
	return {ret,B};
}

vi compress(vi v) {
	map<int,int> m;
	trav(t,v) {
		if (!m.count(t)) {
			int co = sz(m);
			m[t] = co;
		}
		t = m[t];
	}
	return v;
}

void fin(vi a, vi b) {
	// ps("HUH",a,b);
	int lst = MOD;
	vi B = b;
	F0R(i,n/rows-1) {
		pair<int,vi> t = unite(B,a,b);
		if (compress(B) == compress(t.s)) {
			// ps("HUH",B,compress(B));
			tot -= (n/rows-1-i)*t.f;
			break;
		} else {
			tot -= t.f;
		}
		lst = t.f; B = t.s;
	}
}

int main() {
    setIO(); re(n,m,q);
    F0R(i,m) ok[i] = 1;
    F0R(i,q) {
    	int x; re(x);
    	ok[x] = 0;
    }
    tot = m-q;
    rows = m; 
    if (m%7 == 0) rows /= 7;
    else tot *= 7;
    // ps(tot,rows);
    F0R(i,rows) F0R(j,6) tri(7*i+j,7*i+j+1);
    F0R(i,rows-1) F0R(j,7) tri(7*i+j,7*(i+1)+j);
    // ps("??",tot);
    tot *= n/rows;
    vi a,b;
    F0R(j,7) {
    	a.pb(get(j));
    	b.pb(get(7*(rows-1)+j));
    }
    fin(a,b);
    ps(tot);
    // you should actually read the stuff at the bottom
}

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do smth instead of nothing and stay organized
*/


Measured memory_bytes: 5760