#include <bits/stdc++.h>
#pragma GCC optimize(3)
#pragma GCC optimize(2)
using namespace std;
const int maxn = 2e5 + 10;
char s[maxn];
int N, K;
long long T;
int A[22][22];
long long DP[1 << 22];
long long t[22];
int mask[22];
int main() {
  scanf("%d %d %lld", &N, &K, &T);
  scanf("%s", s + 1);
  for (int i = 0; i < K; ++i) {
    scanf("%lld", &t[i]);
  }
  for (int i = 0; i < K; ++i) {
    for (int j = 0; j < K; ++j) {
      scanf("%d", &A[i][j]);
    }
  }
  for (int i = 0; i < K; ++i) {
    DP[1 << i] = t[i];
    mask[i] = -1;
  }
  int S = 0;
  for (int i = 1; i <= N; ++i) {
    int x = s[i] - 'A';
    S |= (1 << x);
    for (int j = 0; j < K; ++j) {
      if (mask[j] >= 0) {
        if ((mask[j] & (1 << j)) == 0 && (mask[j] & (1 << x)) == 0) {
          DP[mask[j]] += A[j][x];
          DP[mask[j] | (1 << j)] -= A[j][x];
          DP[mask[j] | (1 << x)] -= A[j][x];
          DP[mask[j] | (1 << j) | (1 << x)] += A[j][x];
        }
        mask[j] |= (1 << x);
      }
    }
    mask[x] = 0;
  }
  for (int i = 0; i < K; ++i) {
    for (int s = 0; s < (1 << K); ++s) {
      if (s & (1 << i)) {
        DP[s] += DP[s ^ (1 << i)];
      }
    }
  }
  long long ret = 0;
  for (int s = 0; s < (1 << K); ++s) {
    if ((s & S) == s && DP[s] <= T && s != S) {
      ++ret;
    }
  }
  printf("%lld\n", ret);
}
