#include <bits/stdc++.h>
using namespace std;
const int mx = 550;
char s[mx];
vector<int> pos[mx];
int f[2][mx];
int t[mx][mx];
int main() {
  int n, m, K;
  scanf("%d %d %d", &n, &m, &K);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    for (int j = 0; j < m; j++) {
      if (s[j] == '1') pos[i].push_back(j);
    }
    int c = pos[i].size();
    t[i][0] = 0;
    for (int h = 1; h <= c; h++) {
      int mini = 1e9;
      for (int j = 0; j + h - 1 < c; j++) {
        mini = min(mini, pos[i][j + h - 1] - pos[i][j] + 1);
      }
      t[i][h] = mini;
    }
  }
  int rw = 0;
  for (int i = 0; i < n; i++) {
    rw ^= 1;
    int c = pos[i].size();
    for (int k = 0; k <= K; k++) {
      f[rw][k] = 1e9;
      for (int a = 0; a <= k && a <= c; a++) {
        f[rw][k] = min(f[rw][k], f[rw ^ 1][k - a] + t[i][c - a]);
      }
    }
  }
  printf("%d\n", f[rw][K]);
  return 0;
}
