#include <bits/stdc++.h>
using namespace std;
int ans[507];
int a[507][507], f[507][507];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = (1); i <= (n); ++i) {
    string s;
    cin >> s;
    s = '#' + s;
    for (int j = (1); j <= (m); ++j) a[i][j] = a[i][j - 1] + (s[j] - '0');
  }
  for (int i = (0); i <= (n); ++i) {
    for (int j = (0); j <= (k); ++j) f[i][j] = 1000000007;
  }
  f[0][0] = 0;
  for (int i = (1); i <= (n); ++i) {
    for (int j = (0); j <= (m); ++j) ans[j] = 1000000007;
    ans[0] = 0;
    for (int j = (1); j <= (m); ++j) {
      for (int j_ = (j); j_ <= (m); ++j_) {
        int sz = a[i][j_] - a[i][j - 1];
        ans[sz] = min(ans[sz], j_ - j + 1);
      }
    }
    for (int j = (0); j <= (k); ++j) {
      for (int j_ = (0); j_ <= (j); ++j_) {
        int len = a[i][m] - (j - j_);
        f[i][j] = min(f[i][j], f[i - 1][j_] + ans[len]);
      }
    }
  }
  int res = 1000000007;
  for (int j = (0); j <= (k); ++j) res = min(res, f[n][j]);
  cout << res << endl;
  return 0;
}
