//* Problem  : 2230 - Gangsters
//* Contest  : acm.tju.edu.cn
//* Origin   : Northeastern European 1998
//* Type     : Solution
//* Date     : 2008.03.29
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 6.0
//* Algoritm :

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

#include <queue>
using namespace std;

int N, K, T, res, n;

int tmm[128], P[128], S[128];
int now[512];

int prev_a[512], curr_a[512];

void solve()
{
	int *prev_t = prev_a, *curr_t = curr_a;
	for (int t = T; t >= 0; t--)
	{
		for (int i = 0; i < n; i++)
			if (tmm[i] == t)
				now[S[i]] += P[i];
		res = 0;
		///
		for (int k = 0; k <= K; k++)
		{
			int m = max(k ? prev_t[k-1] : 0, max(prev_t[k], prev_t[k+1]));
			if (now[k]) {m += now[k]; now[k] = 0;}
			curr_t[k] = m;
		}
		int *tmp = prev_t; prev_t = curr_t; curr_t = tmp;
	}
	res = prev_t[0];
}

int main()
{
	scanf("%d%d%d", &N, &K, &T); n = N;
	for (int i = 0; i < n; i++)
		scanf("%d", &tmm[i]);
	for (int i = 0; i < n; i++)
		scanf("%d", &P[i]);
	for (int i = 0; i < n; i++)
		scanf("%d", &S[i]);
	solve();
	printf("%d\n", res);
	return 0;
}