#include <bits/stdc++.h>
using namespace std;
int n, m, k;
string s[600];
int cn[600][600];
int count_[600];
int cost[600][600];
int memo[600][600];
int memo2[600][600][3];
int vis[600][600][3];
string temp;
int time_ = 1;
int solve(int i, int k) {
  if (i == n) {
    return 0;
  }
  int &ret = memo[i][k];
  if (ret != -1) return ret;
  int x1 = 1e9;
  for (int j = 0; j <= count_[i]; j++) {
    int E = count_[i] - j;
    if (k - E >= 0) {
      x1 = min(x1, cost[i][j] + solve(i + 1, k - E));
    }
  }
  return ret = x1;
}
int solve2(int i, int k, int ok) {
  if (k == 0) {
    return 0;
  }
  if (i == m) {
    return 0;
  }
  int &ret = memo2[i][k][ok];
  if (vis[i][k][ok] == time_) return ret;
  vis[i][k][ok] = time_;
  int x1 = 1e9, x2 = 1e9;
  if (ok == 0) {
    x1 = solve2(i + 1, k, ok);
    int R = 0;
    if (temp[i] == '1') R = 1;
    x2 = 1 + solve2(i + 1, k - R, 1);
  } else if (ok == 1) {
    int R = 0;
    if (temp[i] == '1') R = 1;
    x1 = 1 + solve2(i + 1, k - R, 1);
    x2 = solve2(i + 1, k, 2);
  } else {
    x1 = solve2(i + 1, k, 2);
  }
  return ret = min(x1, x2);
}
int main() {
  memset(memo, -1, sizeof(memo));
  cin >> n >> m >> k;
  m++;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    s[i] = '0' + s[i];
    for (int j = 0; j < m; j++) {
      int R = 0;
      if (s[i][j] == '1') R++;
      count_[i] += R;
    }
  }
  for (int i = 0; i < n; i++) {
    temp = s[i];
    vector<int> v;
    for (int j = 0; j < m; j++) {
      if (temp[j] == '1') v.push_back(j);
    }
    cost[i][0] = 0;
    for (int j = 0; j < v.size(); j++) {
      int tt = j;
      cost[i][j + 1] = 1e9;
      while (tt != v.size()) {
        cost[i][j + 1] = min(cost[i][j + 1], v[tt] - v[tt - j] + 1);
        tt++;
      }
    }
  }
  cout << solve(0, k);
}
