#include <bits/stdc++.h>
using namespace std;
vector<string> a;
int p[509][509];
int memo[509][509], memo1[509][509], n, m, k;
int dp1(int i, int j) {
  if (memo1[i][j] != -1) {
    return memo1[i][j];
  } else {
    int totalLessons = 0;
    for (int k = 0; k < m; k++) {
      totalLessons += a[i][k] - '0';
    }
    if (j >= totalLessons) {
      return memo1[i][j] = 0;
    } else {
      int ans = INT_MAX, attend = totalLessons - j;
      for (int k = 0; k < m; k++) {
        if (a[i][k] != '1') continue;
        if (k == 0) {
          int idx = lower_bound(p[i], p[i] + m, attend) - p[i];
          if (idx == m) continue;
          ans = min(ans, (int)(lower_bound(p[i], p[i] + m, attend) - p[i] + 1));
        } else {
          int idx = lower_bound(p[i], p[i] + m, p[i][k - 1] + attend) - p[i];
          if (idx == m) continue;
          ans =
              min(ans, (int)(lower_bound(p[i], p[i] + m, p[i][k - 1] + attend) -
                             p[i] - (k - 1)));
        }
      }
      return memo1[i][j] = ans;
    }
  }
}
int dp(int i, int j) {
  if (i == n - 1) {
    return dp1(i, j);
  }
  if (memo[i][j] != -1) {
    return memo[i][j];
  } else {
    int ans = INT_MAX;
    for (int k = 0; k <= j; k++) {
      ans = min(dp1(i, k) + dp(i + 1, j - k), ans);
    }
    return memo[i][j] = ans;
  }
}
int main() {
  cin >> n >> m >> k;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < m; j++) {
      p[i][j] = (a[i][j] - '0') + (j == 0 ? 0 : p[i][j - 1]);
    }
  }
  memset(memo, -1, sizeof(memo));
  memset(memo1, -1, sizeof(memo1));
  cout << dp(0, k) << endl;
  return 0;
}
