#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 509;
int n, m, k, f[MAXN][MAXN], dp[MAXN][MAXN], a[MAXN];
char s[MAXN];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", s);
    int cnt = 0;
    for (int j = 0; j < m; ++j) {
      if (s[j] == '1') a[++cnt] = j;
    }
    a[cnt + 1] = a[cnt] + 1;
    if (cnt == 0) {
      for (int j = 0; j <= k; ++j) f[i][j] = 0;
      continue;
    }
    for (int j = 0; j <= min(k, cnt - 1); ++j) {
      f[i][j] = a[cnt] - a[1] + 1;
      for (int lef = 0; lef <= j; ++lef) {
        int rig = j - lef;
        f[i][j] = min(f[i][j], a[cnt - rig] - a[lef + 1] + 1);
      }
    }
    for (int j = cnt; j <= k; ++j) f[i][j] = 0;
  }
  for (int i = 0; i <= k; ++i) dp[1][i] = f[1][i];
  for (int i = 2; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      dp[i][j] = INF;
      for (int h = 0; h <= j; ++h) {
        dp[i][j] = min(dp[i][j], dp[i - 1][j - h] + f[i][h]);
      }
    }
  }
  printf("%d\n", dp[n][k]);
  return 0;
}
