#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};
const int maxn = 5e2 + 11;
int n, m, k, q[maxn], dp[maxn][maxn], cnt, d[2][maxn * maxn];
string s[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j <= m; ++j) dp[i][j] = inf;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
    for (int j = 0; j < m; ++j) q[i] += (s[i][j] - '0');
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cnt = 0;
      dp[i][q[i]] = 0;
      for (int w = j; w < m; ++w) {
        cnt += (s[i][w] - '0');
        if (cnt > 0) dp[i][q[i] - cnt] = min(dp[i][q[i] - cnt], w - j + 1);
      }
    }
  }
  bool now = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= k; ++j) {
      d[now][j] = d[now ^ 1][j] + dp[i][0];
    }
    for (int w = 1; w <= q[i]; ++w) {
      for (int j = 0; w + j <= k; ++j) {
        d[now][w + j] = min(d[now][w + j], d[now ^ 1][j] + dp[i][w]);
      }
    }
    now ^= 1;
  }
  cout << d[now ^ 1][k];
  return 0;
}
