#include <bits/stdc++.h>
using namespace std;

struct Edge{
	int cap,to,cost,rev;
	Edge(){}
	Edge(int c,int t,int st,int r) : cap(c), to(t), cost(st), rev(r) {}
};

void addEdge(vector<vector<Edge>>&g,int from,int to,int cap,int cost){
	g[from].push_back(Edge(cap,to,cost,g[to].size()));
	g[to].push_back(Edge(0,from,-cost,g[from].size()-1));
}

int minCostFlow(vector<vector<Edge>> g,int s,int t,int f,bool negative=false){
	//if( f == 0 ) return 0;

	typedef pair<int,int> P;
	const int n = g.size();
	int res = 0;
	vector<int> h(n),prevv(n),preve(n);
	const int inf = 1000000;
	while( f > 0 ){
		priority_queue<P,vector<P>,greater<P> > que;
		vector<int> dist(n,inf);
		dist[s] = 0;
		que.push(P(0,s));
		while( !que.empty() ){
			P p = que.top(); que.pop();
			int v = p.second;
			if ( dist[v] < p.first ) continue;
			if( v == t ) break;
			for(int i = 0 ; i < g[v].size() ; i++){
				auto &e = g[v][i];
				if( e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to] ){
					dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
					prevv[e.to] = v;
					preve[e.to] = i;
					que.push(P(dist[e.to],e.to));
				}
			}
		}
		if( dist[t] == inf ) return inf;
		for(int v = 0 ; v < n ; v++){
			h[v] += dist[v];
		}
		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] ){
			auto &e = g[prevv[v]][preve[v]];
			e.cap -= d;
			g[v][e.rev].cap += d;
		}
	}
	return res;
}

int mat[210][210];
int main(){
	int A,B,K;
	cin >> A >> B >> K;
	for(int u = 0 ; u < A ; u++){	
		string s;
		cin >> s;
		for(int v = 0 ; v < B ; v++){
			if( s[v] == '1' )
				mat[u][v]++;
		}
	}

	for(int u = 0 ; u < B ; u++){
		string s;
		cin >> s;
		for(int v = 0 ; v < A ; v++){
			if( s[v] == '1' )
				mat[v][u]++;
		}
	}
	vector<vector<Edge>> g(A+B+2);
	int S = g.size() - 1;
	int T = g.size() - 2;
	for(int i = 0 ; i < A ; i++)
		addEdge(g,S,i,1,0);
	for(int i = 0 ; i < B ; i++)
		addEdge(g,A+i,T,1,0);
	for(int i = 0 ; i < A ; i++)
		for(int j = 0 ; j < B ; j++){
			addEdge(g,i,A+j,1,mat[i][j]);
			//cout << i << " " << j << ": " << mat[i][j] << endl;
		}
	int l = 0, r = min(A,B);
	while( l != r ){
		int m = (l+r+1) / 2;
		if( minCostFlow(g,S,T,m) <= K ){
			l = m;
		}else{
			r = m-1;
		}
	}
	cout << l << endl;

	



}