#include <bits/stdc++.h>
inline char fgc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long readint() {
  register long long res = 0, neg = 1;
  char c = fgc();
  while (c < '0' || c > '9') {
    if (c == '-') neg = -1;
    c = fgc();
  }
  while (c >= '0' && c <= '9') {
    res = res * 10 + c - '0';
    c = fgc();
  }
  return res * neg;
}
const int MAXN = 505;
int n, m, k, f[MAXN][MAXN], cost[MAXN][MAXN], ccnt[MAXN], g[MAXN], pos[MAXN];
char s[MAXN];
std::vector<int> cls;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    int cnt = 0;
    memset(g, 0, sizeof(g));
    for (int i = 1; i <= m; i++)
      if (s[i] == '1') pos[++cnt] = i;
    for (int i = 0; i < cnt; i++) g[i] = pos[cnt] - pos[1] + 1;
    for (int i = 0; i < cnt; i++)
      for (int j = i; j < cnt; j++)
        g[j] = std::min(g[j], pos[cnt - j + i] - pos[i + 1] + 1);
    for (int j = 0; j <= k; j++) cost[i][j] = g[j];
  }
  memset(f, 0x3f, sizeof(f));
  f[0][0] = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= k; j++)
      for (int c = 0; c <= j; c++)
        f[i][j] = std::min(f[i][j], f[i - 1][j - c] + cost[i][c]);
  printf("%d", f[n][k]);
  return 0;
}
