#include <bits/stdc++.h>
using namespace std;
const int MAXN = 505;
int bagg[3][MAXN][MAXN];
int dp[MAXN][MAXN];
string tmp;
int n, m, k;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  while (cin >> n >> m >> k) {
    memset(bagg, 0, sizeof(bagg));
    int cnt0, cnt1;
    int summ = 0;
    for (int i = 1; i <= n; ++i) {
      cnt0 = cnt1 = 0;
      cin >> tmp;
      int st = 0;
      int nail = tmp.length() - 1;
      while (nail >= 0 && tmp[nail] == '0') nail--;
      while (st < tmp.length() && tmp[st] == '0') st++;
      for (int j = st; j <= nail; ++j) {
        if (tmp[j] == '0')
          cnt0++;
        else
          cnt1++;
        bagg[1][i][cnt1] = cnt1 + cnt0;
      }
      cnt0 = 0;
      cnt1 = 0;
      for (int j = nail; j >= st; --j) {
        if (tmp[j] == '0')
          cnt0++;
        else
          cnt1++;
        bagg[2][i][cnt1] = max(bagg[2][i][cnt1], cnt0 + cnt1);
      }
      bagg[0][i][cnt1 + 1] = bagg[1][i][cnt1 + 1] = bagg[2][i][cnt1 + 1] = -1;
      for (int s = 0; bagg[1][i][s] != -1; ++s) {
        for (int t = 0; bagg[2][i][t] != -1 && s + t <= cnt1 &&
                        bagg[1][i][s] + bagg[2][i][t] <= cnt0 + cnt1;
             ++t) {
          bagg[0][i][s + t] =
              max(bagg[0][i][s + t], bagg[1][i][s] + bagg[2][i][t]);
        }
      }
      summ += cnt0 + cnt1;
    }
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= n; ++i) {
      for (int t = 0; t <= k; ++t)
        for (int j = 0; bagg[0][i][j] != -1 && j + t <= k; ++j)
          dp[i][t + j] = max(dp[i][t + j], dp[i - 1][t] + bagg[0][i][j]);
    }
    cout << summ - dp[n][k] << endl;
  }
  return 0;
}
