#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

struct MinimumCostFlow {
	using Flow = int;
	using Cost = int;
	const Cost kInfCost = INF;
	struct Edge {
		int to, rev;
		Flow cap;
		Cost cost;
		Edge() {}
		Edge(int to, int rev, Flow cap, Cost cost) :to(to), rev(rev), cap(cap), cost(cost) {}
	};
	int n;
	vector<vector<Edge>> g;
	vector<Cost> dist;
	vector<int> prevv, preve;
	MinimumCostFlow(int n) :n(n), g(n), dist(n), prevv(n), preve(n) {}
	void addArc(int from, int to, Flow cap, Cost cost) {
		g[from].emplace_back(to, (int)g[to].size(), cap, cost);
		g[to].emplace_back(from, (int)g[from].size() - 1, 0, -cost);
	}
	// s??????t????????????f???????°??????¨???
	// ??????????????´?????? -1
	Cost minimumCostFlow(int s, int t, Flow f) {
		Cost total = 0;
		while (f > 0) {
			// Bellman-Ford
			fill(dist.begin(), dist.end(), kInfCost);
			dist[s] = 0;
			bool update = true;
			while (update) {
				update = false;
				for (int v = 0; v < n; v++) {
					if (dist[v] == kInfCost)continue;
					for (int i = 0; i < g[v].size(); i++) {
						Edge &e = g[v][i];
						if (e.cap > 0 && dist[e.to] > dist[v] + e.cost) {
							dist[e.to] = dist[v] + e.cost;
							prevv[e.to] = v;
							preve[e.to] = i;
							update = true;
						}
					}
				}
			}
			// ????????\???????????????
			if (dist[t] == kInfCost)
				return -1;
			// ?????????????????£??????????????????
			Flow d = f;
			for (int v = t; v != s; v = prevv[v])
				d = min(d, g[prevv[v]][preve[v]].cap);
			f -= d;
			total += dist[t] * d;
			for (int v = t; v != s; v = prevv[v]) {
				Edge &e = g[prevv[v]][preve[v]];
				e.cap -= d;
				g[v][e.rev].cap += d;
			}
		}
		return total;
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	for (int D, K, L; cin >> D >> K >> L&&D;) {
		vector<vector<int>> c(D, vector<int>(K));
		rep(i, 0, D) rep(j, 0, K) { cin >> c[i][j]; }
		int M, N, P; cin >> M >> N >> P;
		vector<vector<int>> r(M, vector<int>(K));
		rep(i, 0, M) rep(j, 0, K) { cin >> r[i][j]; }
		vector<vector<int>> t(P + 1, vector<int>(K));
		rep(i, 0, P) rep(j, 0, K) { cin >> t[i][j]; }

		P++;
		MinimumCostFlow mcf1(M + P + 2);
		int s1 = mcf1.n - 2, t1 = s1 + 1;

		rep(i, 0, P) {
			rep(j, 0, M) {
				bool ok = true;
				rep(k, 0, K) {
					if (r[j][k] < t[i][k])
						ok = false;
				}
				if (ok) {
					MinimumCostFlow mcf2(D + K + 2);
					int s2 = mcf2.n - 2, t2 = s2 + 1;
					int sum = 0;
					rep(d, 0, D) {
						rep(k, 0, K) {
							mcf2.addArc(d, D + k, L, c[d][k]);
						}
					}
					rep(d, 0, D) {
						mcf2.addArc(s2, d, L, 0);
					}
					rep(k, 0, K) {
						if (r[j][k] > t[i][k]) {
							mcf2.addArc(D + k, t2, r[j][k] - t[i][k], 0);
							sum += r[j][k] - t[i][k];
						}
					}
					auto res = mcf2.minimumCostFlow(s2, t2, sum);
					if (res != -1) {
						mcf1.addArc(i, P + j, 1, res);
					}
				}
			}
		}
		rep(i, 0, P) {
			if (i == P - 1)
				mcf1.addArc(s1, i, INF, 0);
			else
				mcf1.addArc(s1, i, 1, 0);
		}
		rep(i, 0, M) {
			mcf1.addArc(P + i, t1, 1, 0);
		}
		cout << mcf1.minimumCostFlow(s1, t1, N) << endl;
	}

	return 0;
}

Measured memory_bytes: 4532