// AOJ 2266 Cache Strategy
// 2018.3.8 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define QMAX 20005
typedef struct { int t, s; } QUE;
QUE que[QMAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int s, int t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].s = s, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		i = min;
	}
}

#define INF 0x10101010
#define MAX 10005
typedef struct { int to, rev; int cap, cost; } EDGE;
EDGE *edge[MAX]; int hi[MAX], lim[MAX];
int V;				// 頂点数
int potential[MAX], dist[MAX], prevv[MAX], preve[MAX];

void check_lim(int a)
{
	if (hi[a] < lim[a]) return;
	if (lim[a] == 0) {
		lim[a] = 32, hi[a] = 0;
		edge[a] = malloc(sizeof(EDGE) *lim[a]);
	} else if (hi[a] == lim[a]) {
		int k = lim[a];
		if (k > 512) k = 512;
		lim[a] += k;
		edge[a] = realloc(edge[a], sizeof(EDGE) *lim[a]);
	}
}

void add_edge(int from, int to, int cap, int cost)
{
	int f, t;
	EDGE *ep;

	check_lim(from), check_lim(to);
	f = hi[from]++, t = hi[to]++;
	ep = &edge[from][f], ep->to = to, ep->cap = cap, ep->cost = cost, ep->rev = t; 
	ep = &edge[to][t], ep->to = from, ep->cap = 0, ep->cost = -cost, ep->rev = f;
}

int minCostFlow(int S, int T, int F, int neg)
{
	int i, v, nv, t, nt, update, ret;
	EDGE *ep;

	ret = 0;
//	memset(potential, 0, V << 2);
  
	while (F > 0) {
		for (v = 0; v < V; v++) dist[v] = INF;
		qsize = 0;
		dist[S] = 0;
		if (neg) {
			neg = 0;
			update = 1;
			while (update) {
				update = 0;
				for (v = 0; v < V; v++) {
					if (dist[v] == INF) continue;
					for (i = 0; i < hi[v]; i++) {
						ep = &edge[v][i];
						if (ep->cap > 0 && dist[ep->to] > dist[v] + ep->cost) {
							dist[ep->to] = dist[v] + ep->cost;
							prevv[ep->to] = v;
							preve[ep->to] = i;
							update = 1;
						}
					}
				}
			}
		} else {
			enq(S, 0);
			while (qsize) {
				v = que[0].s, t = que[0].t, deq();
				if (dist[v] < t) continue;
				for (i = 0; i < hi[v]; i++) {
					ep = &edge[v][i], nv = ep->to;
					nt = t + ep->cost - potential[nv] + potential[v];
					if(ep->cap > 0 && dist[nv] > nt) {
						dist[nv] = nt;
						prevv[nv] = v, preve[nv] = i;
						enq(nv, nt);
					}
				}
			}
		}
		if (dist[T] == INF) return -1;
		for (v = 0; v < V; v++) potential[v] += dist[v];

		t = F;
		for (v = T; v != S; v = prevv[v]) {
			ep = &edge[prevv[v]][preve[v]];
			if (t > ep->cap) t = ep->cap;
		}
		F -= t;

		ret += t * potential[T];
		for (v = T; v != S; v = prevv[v]) {
			ep = &edge[prevv[v]][preve[v]];
			ep->cap -= t;
			edge[v][ep->rev].cap += t;
		}
    }
	return ret;
}

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int w[MAX], a[MAX], b[MAX], c[MAX], f[MAX];

int main()
{
	int M, N, K, i, cnt, ans;
	int as, cs;

	M = in(), N = in(), K = in();
	for (i = 1; i <= N; i++) w[i] = in();
	for (i = 1; i <= K; i++) b[i] = in();
	cnt = 0, as = 1, cs = 0; for (i = 1; i <= K; i++) {
		if (b[i] == b[i-1]) c[cs++] = b[i];
		else                a[as++] = b[i], cnt++;
	}
	for (i = 0; i < cs; i++) a[as++] = c[i];

	V = cnt+1;
	ans = 0; for (i = 1; i <= cnt; i++) {
		ans += w[a[i]];
		if (f[a[i]]) add_edge(f[a[i]], i-1, 1, -w[a[i]]);
		f[a[i]] = i;
	}
	for (i = 1; i < cnt; i++) add_edge(i, i+1, INF, 0);
    printf("%d\n", ans + minCostFlow(1, cnt, M-1, 1));
	return 0;
}
 


Measured memory_bytes: 7332