#include <bits/stdc++.h>
using namespace std;
const int N = 505;
const int M = 505;
char s[M];
vector<int> id[N];
int n, m, k;
int d[N][N], f[N][N];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  memset(d, 0x3f, sizeof d);
  memset(f, 0x3f, sizeof f);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    for (int j = 1; j <= m; j++) {
      if (s[j] == '1') {
        id[i].push_back(j);
      }
    }
    int len = id[i].size();
    f[i][len] = 0;
    for (int j = 0; j < len; j++) {
      for (int r = len - 1 - j; r < len; r++) {
        f[i][j] = min(f[i][j], id[i][r] - id[i][r - (len - j) + 1] + 1);
      }
    }
  }
  d[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    int len = id[i].size();
    for (int j = 0; j <= len; j++) {
      for (int z = j; z <= k; z++) {
        d[i][z] = min(d[i][z], d[i - 1][z - j] + f[i][j]);
      }
    }
  }
  int res = 0x3f3f3f3f;
  for (int i = 0; i <= k; i++) {
    res = min(res, d[n][i]);
  }
  printf("%d\n", res);
  return 0;
}
