#include <bits/stdc++.h>
using namespace std;
int n, m, k;
char s[505][505];
int pre[505][505], dp[505][505];
void precal() {
  int i, j, st, ed, cnt, sum;
  memset(pre, -1, sizeof(pre));
  for (i = 0; i < n; i++) {
    sum = 0;
    for (j = 0; j < m; j++) sum += s[i][j] - '0';
    pre[i][sum] = 0;
    for (st = 0; st < m; st++) {
      if (s[i][st] == '0') continue;
      cnt = 0;
      for (ed = st; ed < m; ed++) {
        if (s[i][ed] == '0') continue;
        cnt++;
        if (pre[i][sum - cnt] == -1 || pre[i][sum - cnt] > ed - st + 1)
          pre[i][sum - cnt] = ed - st + 1;
      }
    }
  }
}
int cal(int i, int ki) {
  if (ki < 0) return 999999999;
  if (i == n) return 0;
  if (dp[i][ki] != -1) return dp[i][ki];
  int ret = 999999999;
  for (int j = 0; j <= ki; j++) {
    if (pre[i][j] == -1) continue;
    ret = min(ret, cal(i + 1, ki - j) + pre[i][j]);
  }
  return dp[i][ki] = ret;
}
int main() {
  int i, j;
  scanf("%d %d %d", &n, &m, &k);
  gets(s[0]);
  for (int i = 0; i < n; i++) gets(s[i]);
  precal();
  memset(dp, -1, sizeof(dp));
  printf("%d\n", cal(0, k));
  return 0;
}
