#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - 48;
    s = getchar();
  }
  return f * x;
}
const int N = 2e5 + 5, M = 23;
int dp[(1 << M)], pre[M], a[M], ma[M][M];
char s[N];
int main() {
  int n = read(), k = read(), T = read();
  scanf("%s", s + 1);
  for (int i = 0; i < k; i++) a[i] = read();
  for (int i = 0; i < k; i++)
    for (int j = 0; j < k; j++) ma[i][j] = read();
  for (int i = 0; i < k; i++) dp[1 << i] = a[i];
  int sta = 0;
  memset(pre, -1, sizeof(pre));
  for (int i = 1; i <= n; i++) {
    int ch = s[i] - 'A';
    sta |= (1 << ch);
    for (int j = 0; j < k; j++) {
      if (pre[j] >= 0 && !(pre[j] & (1 << j)) && !(pre[j] & (1 << ch))) {
        dp[pre[j]] += ma[j][ch];
        dp[pre[j] | (1 << j)] -= ma[j][ch];
        dp[pre[j] | (1 << ch)] -= ma[j][ch];
        dp[pre[j] | (1 << j) | (1 << ch)] += ma[j][ch];
      }
      pre[j] |= (1 << ch);
    }
    pre[ch] = 0;
  }
  for (int i = 0; i < k; i++)
    for (int j = 0; j < (1 << k); j++)
      if (j & (1 << i)) dp[j] += dp[j ^ (1 << i)];
  int ans = 0;
  for (int i = 0; i < (1 << k); i++)
    if (((i & sta) == i) && dp[i] <= T && i != sta) ans++;
  printf("%d\n", ans);
  return 0;
}
