#include <bits/stdc++.h>
using namespace std;
const int inf = 1000;
const int inf2 = inf * inf;
const int maxn = 505;
vector<int> a[maxn];
int par[maxn][maxn];
int dp[maxn][maxn];
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, r;
  cin >> n >> m >> r;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      char c;
      cin >> c;
      if (c == '1') a[i].push_back(j);
    }
  }
  for (int i = 0; i <= n + 1; i++)
    for (int j = 0; j <= m + 1; j++) par[i][j] = inf;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < a[i].size(); j++) {
      for (int k = j; k < a[i].size(); k++) {
        int t = a[i][k] - a[i][j] + 1;
        int p1 = j;
        int p2 = a[i].size() - k - 1;
        if (par[i][p1 + p2] > t) par[i][p1 + p2] = t;
      }
    }
  }
  int ls = m;
  for (int i = 1; i <= n; i++) {
    for (int j = m; j >= 0; j--) {
      if (par[i][j] == inf)
        par[i][j] = 0;
      else
        break;
    }
  }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= r + 1; j++) dp[i][j] = inf2;
  for (int i = 0; i <= r; i++) dp[1][i] = par[1][i];
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= r; j++) {
      for (int k = 0; k <= j; k++) {
        dp[i][j] = min(dp[i][j], par[i][k] + dp[i - 1][j - k]);
      }
    }
  }
  int ans = inf2;
  for (int i = 0; i <= r; i++) ans = min(ans, dp[n][i]);
  cout << ans;
  return 0;
}
