#include <bits/stdc++.h>
using namespace std;
char c;
int dp[510][510], f[510][510];
int pos[510][510], cnt[510];
int n, m, k;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> c;
      if (c == '1') cnt[i]++, pos[i][cnt[i]] = j;
    }
    int maxx = cnt[i];
    if (maxx == 0) continue;
    dp[i][0] = pos[i][maxx] - pos[i][1] + 1;
    for (int j = 1; j <= maxx; j++) {
      int l = maxx - j, minn = 9999999;
      if (l == 0) break;
      for (int k = 1; k + l - 1 <= maxx; k++) {
        minn = min(minn, pos[i][k + l - 1] - pos[i][k] + 1);
      }
      dp[i][j] = minn;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      int minn = 9999999;
      for (int k = 0; k <= j; k++) {
        minn = min(minn, f[i - 1][j - k] + dp[i][k]);
      }
      f[i][j] = minn;
    }
  }
  printf("%d", f[n][k]);
  return 0;
}
