#include <bits/stdc++.h>
using namespace std;
string S[505], R[505];
vector<int> waste[505], suff[505];
long long dp[505][505], fp[505][505], attend[505];
long long getCost(int N, int items) {
  if (items == 0) return 0;
  if (items == waste[N].size() + 1) return attend[N];
  if (fp[N][items] != -1) return fp[N][items];
  int sum = 0, ans = 0;
  int sz = waste[N].size();
  for (int i = 0; i <= items; i++) {
    if (i != items)
      ans = max(ans, sum + suff[N][sz - items + i]);
    else
      ans = max(ans, sum);
    sum += waste[N][i];
  }
  return fp[N][items] = ans;
}
long long solve(int N, int K) {
  if (N < 0) return 0;
  if (dp[N][K] != -1) return dp[N][K];
  int pre = 0;
  long long ans = 0;
  for (int i = 0; i <= min(K, (int)waste[N].size() + 1); i++)
    ans = max(ans, solve(N - 1, K - i) + getCost(N, i));
  return dp[N][K] = ans;
}
int main() {
  int N, M, K;
  cin >> N >> M >> K;
  int newN = 0;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
    int isOk = 0;
    for (int j = 0; j < M; j++) isOk |= (S[i][j] == '1');
    if (isOk) R[newN++] = S[i];
  }
  N = newN;
  for (int i = 0; i < N; i++) S[i] = R[i];
  int sum = 0, ans = 0;
  for (int i = 0; i < N; i++) {
    int prev = -1;
    int first1 = -1, last1 = -1;
    for (int j = 0; j < M; j++) {
      if (S[i][j] == '0') continue;
      if (prev != -1) {
        suff[i].push_back(0);
        waste[i].push_back(j - prev), sum += (j - prev);
      }
      if (first1 == -1) first1 = j;
      last1 = prev = j;
    }
    for (int j = (int)waste[i].size() - 1; j >= 0; j--) {
      if (j == waste[i].size() - 1)
        suff[i][j] = waste[i][j];
      else
        suff[i][j] = waste[i][j] + suff[i][j + 1];
    }
    attend[i] = last1 - first1 + 1;
    ans += attend[i];
  }
  memset(dp, -1, sizeof(dp));
  memset(fp, -1, sizeof(fp));
  int savedHours = solve(N - 1, K);
  cout << ans - savedHours << "\n";
  return 0;
}
