#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int f[512][512], g[512][512], cyc[512][512];
int tot[512];
void PreDeal(int t) {
  int num[512], left[512], right[512];
  memset(num, 0, sizeof(num));
  memset(left, 0, sizeof(left));
  memset(right, 0, sizeof(right));
  int ph = 0, pt = 0;
  tot[t] = 0;
  for (int i = 1; i <= m; i++) scanf("%1d", &num[i]);
  for (int i = 1; i <= m; i++)
    if (num[i] == 1) {
      left[++ph] = i;
      tot[t]++;
    }
  for (int i = m; i >= 1; i--)
    if (num[i] == 1) {
      right[++pt] = i;
    }
  int ori;
  if (tot[t] != 0)
    ori = right[1] - left[1] + 1;
  else
    ori = 0;
  f[0][0] = 0;
  g[t][0] = ori;
  if (tot[t] == 1) {
    g[t][1] = 0;
    return;
  }
  for (int i = 1; i <= tot[t]; i++) {
    for (int j = 0; j <= i; j++) {
      int k = i - j;
      f[i][j] = 0;
      if (k > 0 && k < tot[t])
        f[i][j] = max(f[i][j], f[i - 1][j] + (right[k] - right[k + 1]));
      if (j > 0 && j < tot[t])
        f[i][j] = max(f[i][j], f[i - 1][j - 1] + (left[j + 1] - left[j]));
      if (f[i][j] > g[t][i]) g[t][i] = f[i][j];
    }
    g[t][i] = ori - g[t][i];
    if (g[t][i] < 0) g[t][i] = 0;
  }
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    PreDeal(i);
  }
  memset(cyc, 1, sizeof(cyc));
  for (int j = 0; j <= k; j++) cyc[0][j] = 0;
  for (int i = 1; i <= n; i++) {
    cyc[i][0] = cyc[i - 1][0] + g[i][0];
    for (int v = 1; v <= k; v++) {
      cyc[i][v] = cyc[i - 1][v] + g[i][0];
      for (int j = 0; j <= tot[i] && j <= v; j++) {
        cyc[i][v] = min(cyc[i][v], cyc[i - 1][v - j] + g[i][j]);
      }
    }
  }
  cout << cyc[n][k] << endl;
  return 0;
}
