#include <bits/stdc++.h>
using namespace std;
int T[27], A[27][27], P[27], use;
long long Q[1 << 22];
int main() {
  int n, k, t;
  cin >> n >> k >> t;
  string S;
  cin >> S;
  S = " " + S;
  for (int i = 1; i <= k; ++i) cin >> T[i];
  for (int i = 1; i <= k; ++i)
    for (int j = 1; j <= k; ++j) cin >> A[i][j];
  memset(P, -1, sizeof(P));
  for (int i = 1; i <= n; ++i) {
    int x = S[i] - 'A' + 1;
    for (int j = 1; j <= k; ++j) {
      if (P[j] != -1) {
        Q[P[j]] += A[j][x];
        Q[P[j] | (1 << (j - 1))] -= A[j][x];
        Q[P[j] | (1 << (x - 1))] -= A[j][x];
        Q[P[j] | (1 << (j - 1)) | (1 << (x - 1))] += A[j][x];
      }
      P[j] |= (1 << (x - 1));
    }
    P[x] = 0;
    use |= (1 << (x - 1));
  }
  for (int i = 1; i <= k; ++i) Q[1 << (i - 1)] += T[i];
  for (int i = 0; i < k; ++i)
    for (int j = 0; j < (1 << k); ++j)
      if (j & (1 << i)) Q[j] += Q[j ^ (1 << i)];
  int ans = 0;
  for (int i = 0; i < (1 << k); ++i)
    if ((i & use) == i)
      if (Q[i] <= t && i != use) ++ans;
  cout << ans;
}
