#include <bits/stdc++.h>
using namespace std;
int n, m, k, dp1[505][505], dp2[505][505];
char matr[505][505];
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) cin >> (matr[i] + 1);
  for (int i = 1; i <= n; ++i) {
    int tot1 = 0;
    for (int j = 1; j <= m; ++j) tot1 += (matr[i][j] == '1');
    for (int j = 0; j < tot1; ++j) dp1[i][j] = 505;
    for (int j = tot1; j <= m; ++j) dp1[i][j] = 0;
    for (int j = 1; j <= m; ++j) {
      int crt = tot1;
      for (int k = j; k <= m; ++k) {
        crt -= (matr[i][k] == '1');
        dp1[i][crt] = min(dp1[i][crt], k - j + 1);
      }
    }
  }
  for (int j = 0; j <= k; ++j) dp2[1][j] = dp1[1][j];
  for (int i = 2; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      dp2[i][j] = 505 * 505;
      for (int jj = 0; jj <= j; ++jj)
        dp2[i][j] = min(dp2[i][j], dp2[i - 1][jj] + dp1[i][j - jj]);
    }
  }
  int ans = 505 * 505;
  for (int i = 0; i <= k; ++i) ans = min(ans, dp2[n][i]);
  cout << ans << "\n";
  return 0;
}
