#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
const long long INF = (long long)0x7fffffffffff;
long long dp[maxn][maxn][maxn], wi[maxn], c[maxn];
long long min(long long a, long long b) { return a > b ? b : a; }
int main() {
  int n, m, k, temp, flag = 1, ans1 = 0;
  cin >> n >> m >> k;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int l = 0; l <= n; l++) {
        dp[i][j][l] = INF;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= m; i++) cin >> wi[i];
  if (c[1] == 0)
    for (int i = 1; i <= m; i++) dp[1][i][1] = wi[i];
  else
    dp[1][c[1]][1] = 0;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> wi[j];
      for (int l = 1; l <= i; l++) {
        if (c[i] == 0) {
          for (int p = 1; p <= m; p++) {
            if (p == j) {
              dp[i][j][l] = min(dp[i][j][l], dp[i - 1][j][l] + wi[j]);
            } else {
              dp[i][j][l] = min(dp[i][j][l], dp[i - 1][p][l - 1] + wi[j]);
            }
          }
        } else {
          for (int p = 1; p <= m; p++) {
            if (p == c[i]) {
              dp[i][c[i]][l] = min(dp[i][c[i]][l], dp[i - 1][c[i]][l]);
            } else {
              dp[i][c[i]][l] = min(dp[i][c[i]][l], dp[i - 1][p][l - 1]);
            }
          }
        }
      }
    }
  }
  long long ans = INF;
  for (int i = 1; i <= m; i++) ans = min(ans, dp[n][i][k]);
  if (ans >= INF)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
