#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  string a[508];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int what[508][508];
  int total[508];
  int final[508][508];
  int ans[508][508];
  int sm = 0;
  for (int i = 0; i < n; i++) {
    sm = 1;
    total[i] = 0;
    for (int j = 0; j < a[i].size(); j++) {
      what[i][j] = 10000000;
      total[i] += a[i][j] - '0';
      if (a[i][j] == '1') {
        final[i][total[i]] = j;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    int s, e;
    for (int j = 0; j < total[i]; j++) {
      for (int kk = 1; kk <= j + 1; kk++) {
        s = final[i][total[i] - j + (kk - 1)] - final[i][kk] + 1;
        what[i][j] = min(what[i][j], s);
      }
    }
    for (int j = total[i]; j <= m; j++) {
      what[i][j] = 0;
    }
    if (k > m) {
      for (int j = m; j <= k; j++) {
        what[i][j] = 0;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      ans[i][j] = 10000000;
    }
  }
  for (int j = 0; j <= k; j++) {
    if (j >= total[0]) {
      ans[0][j] = 0;
    } else {
      ans[0][j] = what[0][j];
    }
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int kk = 0; kk <= j; kk++) {
        ans[i][j] = min(ans[i][j], ans[i - 1][kk] + what[i][j - kk]);
      }
    }
  }
  if (ans[n - 1][k] < 0) {
    cout << 0;
  } else {
    cout << ans[n - 1][k];
  }
}
