#include <bits/stdc++.h>
using namespace std;
int n, m, k;
char s[512];
int g[512][512];
int dp[512][512];
int f(int i, int k) {
  int& r = dp[i][k];
  if (r >= 0) return r;
  if (i == n)
    r = 0;
  else {
    r = 1 << 30;
    for (int j = 0, ThxDem = k + 1; j < ThxDem; ++j)
      r = min(r, g[i][j] + f(i + 1, k - j));
  }
  return r;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) {
    scanf("%s", s);
    vector<int> x;
    for (int j = 0, ThxDem = m; j < ThxDem; ++j)
      if (s[j] == '1') x.push_back(j);
    for (int k = 0, ThxDem = ((int)(x).size()); k < ThxDem; ++k) {
      g[i][k] = 1 << 30;
      for (int j = 0, ThxDem = k + 1; j < ThxDem; ++j) {
        g[i][k] = min(g[i][k], x[((int)(x).size()) - 1 - (k - j)] - x[j] + 1);
      }
    }
  }
  memset(dp, -1, sizeof(dp));
  printf("%d\n", f(0, k));
  return 0;
}
