#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(auto i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()



typedef int Weight;
typedef int Cap;
const Weight W_INF = INT_MAX;
const Weight W_ZERO = 0;
const Cap C_INF = INT_MAX;
const Cap C_ZERO = 0;

struct Edge {
	int src, dst;
	Cap capacity;
	Weight cost;
	Edge(int src, int dst, const Cap& acap, const Weight& acost) :
		src(src), dst(dst), capacity(acap), cost(acost) {
	}
};
bool operator < (const Edge &e, const Edge &f) {
	return e.cost > f.cost;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;


#define RESIDUE(s,t) (capacity[s][t]-flow[s][t])
#define RCOST(u,v) (cost[u][v] + h[u] - h[v])

//??°?????????????????§???????????????????????¨?????????

//Graph &ag
//????????§???????????????(u, v, capacity, cost) ??????????????????(u, v, 0, -cost) ???????????°????????????????????¶?????????????????§????´???°????????§???????????°???????????????
//int s, int t
//?????????????§??????¨?????????
//?????????
//?????¨??¨????????????????????????
pair<Weight, Cap> minimumCostFlow(const int amax,const Graph &ag, int s, int t) {
	//check???????´???°??????????????£???????????????
	Graph g(ag);
	for (int i = 0; i < ag.size(); ++i) {
		for (int j = 0; j < ag[i].size(); ++j) {
			int d = ag[i][j].dst;
			int s = ag[i][j].src;

			bool ok = false;
			for (int k = 0; k < ag[d].size(); ++k) {
				if (ag[d][k].src == s) {
					ok = true;
					break;
				}
			}
			if (!ok) {
				g[d].push_back(Edge(d, s, C_ZERO, -ag[i][j].cost));
			}
		}
	}
	const int n = g.size();
	vector<vector<Cap>> capacity(n, vector<Cap>(n)), flow(n, vector<Cap>(n));
	vector<vector<Weight>>cost(n, vector<Weight>(n));
	for (int u = 0; u < n; ++u) {
		for (auto e : g[u]) {
			capacity[e.src][e.dst] = capacity[e.src][e.dst] + e.capacity;
			cost[e.src][e.dst] = cost[e.src][e.dst] + e.cost;
		}
	}
	pair<Weight, Cap> total; // (cost, flow)
	vector<Weight> h(n);

	for (Cap F = amax; F > 0; ) { // residual flow
		vector<Weight> d(n, W_INF); d[s] = W_ZERO;
		vector<int> p(n, -1);
		priority_queue<Edge> Q; // "e < f" <=> "e.cost > f.cost"
		for (Q.push(Edge(-2, s, C_ZERO, W_ZERO)); !Q.empty(); ) {
			Edge e = Q.top(); Q.pop();
			if (p[e.dst] != -1) continue;
			p[e.dst] = e.src;
			FOR(f, g[e.dst]) {
				if (RESIDUE(f->src, f->dst) > 0) {
					if (d[f->dst] > d[f->src] + RCOST(f->src, f->dst)) {
						d[f->dst] = d[f->src] + RCOST(f->src, f->dst);
						Q.push(Edge(f->src, f->dst, 0, d[f->dst]));
					}
				}
			}
		}
		if (p[t] == -1) {
			break;
		}

		Cap f = F;
		for (int u = t; u != s; u = p[u]) {
			f = min(f, RESIDUE(p[u], u));
		}
		for (int u = t; u != s; u = p[u]) {
			total.first = total.first + f * cost[p[u]][u];
			flow[p[u]][u] = flow[p[u]][u] + f; flow[u][p[u]] = flow[u][p[u]] - f;
		}
		F = F - f;
		total.second = total.second + f;
		for (int u = 0; u < n; ++u) {
			h[u] = h[u] + d[u];
		}
	}
	return total;
}
void add_edge(Graph&g, const int from, const int to, const Cap& cap, const Weight& weight) {
	assert(weight >= 0);//????????¨?????°??????
	g[from].push_back(Edge(from, to, cap, weight));
}

int main() {
	int A, B, K; cin >> A >> B >> K;
	vector<vector<int>>costs(A, vector<int>(B));
	for (int i = 0; i < A; ++i) {
		string st; cin >> st;
		for (int j = 0; j < B; ++j) {
			auto c = st[j] != '1';
			if (c == 0)costs[i][j] += 1;
		}
	}
	for (int i = 0; i < B; ++i) {
		string st; cin >> st;
		for (int j = 0; j < A; ++j) {
			auto c = st[j]!= '1';
			if (c == 0)costs[j][i] += 1;
		}
	}

	const int start = 0;
	const int aa = start + 1;
	const int bb=aa+A;
	const int goal = bb + B;
	Graph g(goal + 1);
	for (int i = 0; i < A; ++i) {
		g[start].push_back(Edge(start, aa + i, 1, 0));
	}
	for (int i = 0; i < A; ++i) {
		for (int j = 0; j < B; ++j) {
			g[aa + i].push_back(Edge(aa + i, bb + j, 1, costs[i][j]));
		}
	}
	for (int j = 0; j < B; ++j) {
		g[bb + j].push_back(Edge(bb + j, goal, 1, 0));
	}
	int amin = 0;
	int amax = min(A,B)+1;
	while (amin + 1 != amax) {
		int amid = (amin + amax) / 2;
		auto p = minimumCostFlow(amid, g, start, goal);
		if (minimumCostFlow(amid, g, start, goal).first <=K) {
			amin = amid;
		}
		else {
			amax = amid;
		}
	}
	cout << amin << endl;
	return 0;
}

Measured memory_bytes: 8064