#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int dp[N][N], opt[N][N];
vector<int> day[N];
int main() {
  int n, m, p;
  scanf("%d %d %d", &n, &m, &p);
  for (int i = 1; i <= n; i++) {
    char s[m];
    scanf("%s", s);
    for (int j = 0; j < strlen(s); j++) {
      if (s[j] == '1') day[i].push_back(j + 1);
    }
  }
  memset(dp, 0x3f, sizeof(dp));
  memset(opt, 0x3f, sizeof(opt));
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= p; j++) {
      if (day[i].size() && j < day[i].size())
        opt[i][j] = 0x3f3f3f3f;
      else
        opt[i][j] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    int sz = day[i].size();
    for (int j = 0; j < sz; j++) {
      for (int k = j; k < sz; k++) {
        opt[i][j + sz - k - 1] =
            min(opt[i][j + sz - k - 1], day[i][k] - day[i][j] + 1);
      }
    }
  }
  for (int i = 1; i <= p; i++) dp[0][i] = opt[0][i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= p; j++) {
      if (dp[i][j] != 0x3f3f3f3f) {
        for (int k = 0; j + k <= p; k++) {
          dp[i + 1][j + k] = min(dp[i + 1][j + k], dp[i][j] + opt[i + 1][k]);
        }
      }
    }
  }
  int ans = 0x3f3f3f3f;
  for (int i = 0; i <= p; i++) ans = min(ans, dp[n][i]);
  printf("%d", ans);
  return 0;
}
