#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <functional>
#include <queue>
using namespace std;

const int MAX_V = 100010;
using Capacity = int;
using Cost = int;
const auto inf = numeric_limits<Capacity>::max() / 8;

struct Edge {
	int dst;
	Capacity cap, cap_orig;
	Cost cost;
	int revEdge; bool isRev;
	Edge(int dst, Capacity cap, Cost cost, int revEdge, bool isRev)
		:dst(dst), cap(cap), cap_orig(cap), cost(cost), revEdge(revEdge), isRev(isRev) {
	}
};

struct PrimalDual {
	int n;
	vector<vector<Edge> > g;
	vector<int> top;
	PrimalDual(int n_) : n(n_), g(vector<vector<Edge> >(n_)) {}
	void add_edge(int src, int dst, Capacity cap, Cost cost) { // ?????????
		g[src].emplace_back(dst, cap, cost, g[dst].size(), false);
		g[dst].emplace_back(src, 0, -cost, g[src].size() - 1, true);
	}
	Cost solve(int s, int t, int f) {
		Cost res = 0;
		static Cost h[MAX_V], dist[MAX_V];
		static int prevv[MAX_V], preve[MAX_V];
		fill(h, h + n, 0);
		assert(top.size() == n);
		for(int i = 0; i < n; i++) {
			int v = top[i];
			for(Edge& e : g[v]) {
				if(e.cap == 0) continue;
				int u = e.dst;
				h[u] = min(h[u], h[v] + e.cost);
			}
		}
		while(f > 0) {
			typedef pair<Cost, int> pcv;
			priority_queue<pcv, vector<pcv>, greater<pcv> > q;
			for(int i = 0; i < n; i++) {
				dist[i] = inf;
			}
			dist[s] = 0;
			q.emplace(pcv(0, s));
			while(q.size()) {
				pcv p = q.top(); q.pop();
				int v = p.second;
				if(dist[v] < p.first) continue;
				for(int i = 0; i < g[v].size(); i++) {
					Edge &e = g[v][i];
					if(e.cap > 0 && dist[e.dst] > dist[v] + e.cost + h[v] - h[e.dst]) {
						dist[e.dst] = dist[v] + e.cost + h[v] - h[e.dst];
						prevv[e.dst] = v;
						preve[e.dst] = i;
						q.emplace(pcv(dist[e.dst], e.dst));
					}
				}
			}
			if(dist[t] == inf) {
				return -1;
			}
			for(int v = 0; v < n; v++) {
				h[v] += dist[v];
			}
			// s-t ????????????????????£??????????????????
			int d = f;
			for(int v = t; v != s; v = prevv[v]) {
				d = min(d, g[prevv[v]][preve[v]].cap);
			}
			f -= d;
			res += d * h[t];
			for(int v = t; v != s; v = prevv[v]) {
				Edge &e = g[prevv[v]][preve[v]];
				e.cap -= d;
				g[v][e.revEdge].cap += d;
			}
		}
		return res;
	}
	// ??????????????????=???????????????-?????¨??????????????¨???
	void view() {
		for(int i = 0; i < g.size(); i++) {
			for(int j = 0; j < g[i].size(); j++) {
				if(!g[i][j].isRev) {
					Edge& e = g[i][j];
					printf("%3d->%3d (flow:%d)\n", i, e.dst, e.cap_orig - e.cap);
				}
			}
		}
	}
};


typedef long long ll;
ll w[10000];
int a[10000];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int M, N, K;
	cin >> M >> N >> K;

	for(int i = 0; i < N; i++) {
		cin >> w[i];
	}

	PrimalDual pd(K);

	ll sum = 0;
	for(int i = 0; i < K; i++) {
		cin >> a[i];
		a[i]--;
		if(i > 0 && a[i - 1] == a[i]) continue;
		sum += w[a[i]];
	}

	for(int i = 0; i < K - 1; i++) {
		pd.add_edge(i, i + 1, 1000000, 0);
	}
	vector<int> prev(N, -1);
	for(int i = 0; i < K; i++) {
		if(prev[a[i]] != -1 && prev[a[i]] + 1 != i) {
			pd.add_edge(prev[a[i]] + 1, i, 1, -w[a[i]]);
		}
		prev[a[i]] = i;
	}

	for(int i = 0; i < K; i++) {
		pd.top.push_back(i);
	}


	ll res = pd.solve(0, K - 1, M - 1);
	//assert(res != -1);
	cout << sum + res << endl;
}

Measured memory_bytes: 4776