#include<stdio.h>
#include<vector>
#include<queue>
#include<algorithm>
#include<string.h>
using namespace std;
namespace MCF {
	// required <string.h> <vector> <queue> <algorithm>
	#define MAXN 700
	#define MAXM 100000
	#define wint int
	#define cint int
	const wint wEPS = 0;
	const wint wINF = 1001001001;
	const cint cEPS = 0;
	const cint cINF = 1001001001;
	int n, m, ptr[MAXN], next[MAXM], zu[MAXM];
	wint capa[MAXM], tof;
	cint cost[MAXM], toc, d[MAXN], pot[MAXN];
	int vis[MAXN], pree[MAXN];
	void init(int _n) {
		n = _n; m = 0; memset(ptr, ~0, n * 4);
	}
	void ae(int u, int v, wint w, cint c) {
		next[m] = ptr[u]; ptr[u] = m; zu[m] = v; capa[m] = w; cost[m] = +c; ++m;
		next[m] = ptr[v]; ptr[v] = m; zu[m] = u; capa[m] = 0; cost[m] = -c; ++m;
	}
	bool solve(int src, int ink, wint flo = wINF) {
		int i, u, v;
		wint f;
		cint c, cc;
		memset(pot, 0, n * sizeof(cint));
		//*
		for (bool cont = 1; cont; ) {
			cont = 0;
			for (u = 0; u < n; ++u) for (i = ptr[u]; ~i; i = next[i]) if (capa[i] > wEPS) {
				if (pot[zu[i]] > pot[u] + cost[i] + cEPS) {
					pot[zu[i]] = pot[u] + cost[i]; cont = 1;
				}
			}
		}
		//*/
		for (toc = 0, tof = 0; tof + wEPS < flo; ) {
			typedef pair<cint,int> node;
			priority_queue< node,vector<node>,greater<node> > q;
			for (u = 0; u < n; ++u) { d[u] = cINF; vis[u] = 0; }
			for (q.push(make_pair(d[src] = 0, src)); !q.empty(); ) {
				c = q.top().first; u = q.top().second; q.pop();
				if (vis[u]++) continue;
				for (i = ptr[u]; ~i; i = next[i]) if (capa[i] > wEPS) {
					cc = c + cost[i] + pot[u] - pot[v = zu[i]];
					if (d[v] > cc) { q.push(make_pair(d[v] = cc, v)); pree[v] = i; }
				}
			}
			if (!vis[ink]) return 0;
			f = flo - tof;
			for (v = ink; v != src; v = zu[i ^ 1]) { i = pree[v]; f=min(f,capa[i]); }
			for (v = ink; v != src; v = zu[i ^ 1]) { i = pree[v]; capa[i] -= f; capa[i ^ 1] += f; }
			tof += f;
			toc += f * (d[ink] - pot[src] + pot[ink]);
			for (u = 0; u < n; ++u) pot[u] += d[u];
		}
		return 1;
	}
}
int p[10][10];
int q[210][10];
int r[210][10];
int dp[10][10][7000];
int pow3[9];
int main(){
	int a,b,c;
	while(scanf("%d%d%d",&a,&b,&c),a){
		for(int i=0;i<a;i++)for(int j=0;j<b;j++)scanf("%d",&p[i][j]);
		int d,e,f;
		scanf("%d%d%d",&d,&e,&f);
		for(int i=0;i<d;i++){
			for(int j=0;j<b;j++)scanf("%d",&q[i][j]);
		}
		for(int i=0;i<f;i++){
			for(int j=0;j<b;j++)scanf("%d",&r[i][j]);
		}
		for(int i=0;i<b;i++)r[f][i]=0;
		f++;
		pow3[0]=1;
		for(int i=1;i<9;i++)pow3[i]=pow3[i-1]*3;
		for(int i=0;i<=a;i++){
			for(int j=0;j<=c;j++){
				for(int k=0;k<pow3[b];k++)
					dp[i][j][k]=999999999;
			}
		}
		dp[0][0][0]=0;
		for(int i=0;i<a;i++){
			for(int j=0;j<=c;j++){
				for(int k=0;k<pow3[b];k++){
					dp[i+1][0][k]=min(dp[i+1][0][k],dp[i][j][k]);
					if(j==c)continue;
					for(int l=0;l<b;l++){
						int tmp=k%pow3[l+1]/pow3[l];
						if(tmp==2)continue;
						dp[i][j+1][k+pow3[l]]=min(dp[i][j+1][k+pow3[l]],dp[i][j][k]+p[i][l]);
					}
				}
			}
		}
		//for(int i=0;i<pow3[b];i++)printf("%d ",dp[a][0][i]);
		MCF::init(d+f+2);
		int s=d+f;
		int t=d+f+1;
		for(int i=0;i<d;i++){
			for(int j=0;j<f;j++){
				bool ok=true;
				for(int k=0;k<b;k++)if(q[i][k]<r[j][k])ok=false;
				if(ok){
					int tmp=0;
					for(int k=0;k<b;k++)tmp+=pow3[k]*(q[i][k]-r[j][k]);
					if(dp[a][0][tmp]<9999999)
					MCF::ae(i,d+j,1,dp[a][0][tmp]);
				}
				
			}
		}
		for(int i=0;i<d;i++)MCF::ae(s,i,1,0);
		for(int i=0;i<f-1;i++)MCF::ae(i+d,t,1,0);
		MCF::ae(d+f-1,t,1000,0);
		bool res=MCF::solve(s,t,e);
		if(!res)printf("-1\n");
		else printf("%d\n",MCF::toc);
	}
}

Measured memory_bytes: 5144