#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 5e6 + 10;
int a[5010][5010], s[5010][5010];
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, m, k;
cin >> n >> m >> k;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
char c;
cin >> c;
a[i][j] = c - 48;
}
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + a[i][j];
}
}
int minv = INT_MAX;
for(int x1 = 1; x1 <= n; x1++) {
for(int x2 = x1; x2 <= n; x2++) {
for(int y1 = 1; y1 <= m; y1++) {
for(int y2 = y1; y2 <= m; y2++) {
int h = s[x2][y2] - s[x1 - 1][y2] - s[x2][y1 - 1] + s[x1 - 1][y1 - 1];
if(h >= k) {
int gs = (x2 - x1 + 1) * (y2 - y1 + 1);
minv = min(gs, minv);
}
}
}
}
}
cout << minv;
return 0;
}