#include <bits/stdc++.h>
using namespace std;
string arr[505];
int dp1[505][505], cnt[505], val[505][505], dp2[505][505];
int main() {
  int i, j, k;
  int n, m, x;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &x);
  for (i = 1; i <= n; i++) cin >> arr[i];
  for (i = 0; i <= n; i++) {
    for (j = 1; j <= m; j++) dp1[i][j] = 1e6;
    for (j = 0; j <= x; j++) dp2[i][j] = 1e6;
  }
  dp2[0][0] = 0;
  for (i = 1; i <= n; i++) {
    if (arr[i][0] == '1') val[i][0] = 1;
    for (j = 1; j < m; j++) {
      if (arr[i][j] == '1')
        val[i][j] = val[i][j - 1] + 1;
      else
        val[i][j] = val[i][j - 1];
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 0; j < m; j++) {
      for (k = j; k < m; k++) {
        if (j == 0)
          dp1[i][val[i][k]] = min(dp1[i][val[i][k]], k - j + 1);
        else
          dp1[i][val[i][k] - val[i][j - 1]] =
              min(dp1[i][val[i][k] - val[i][j - 1]], k - j + 1);
      }
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= x; j++) {
      for (k = 0; k <= j; k++) {
        int temp = val[i][m - 1] - (j - k);
        if (temp < 0) continue;
        dp2[i][j] = min(dp2[i][j], dp2[i - 1][k] + dp1[i][temp]);
      }
    }
  }
  int ans = 1e6;
  for (i = 0; i <= x; i++) ans = min(ans, dp2[n][i]);
  printf("%d\n", ans);
  return 0;
}
