#include <bits/stdc++.h>
const int N = 200005;
const int M = 22;
char str[N];
int a[M][M], b[M], last[M], zt[M], dp[2][1 << M];
int main() {
  int n, k, t, i, j, st = 0;
  scanf("%d%d%d", &n, &k, &t);
  scanf("%s", str);
  for (i = 0; i < k; i++) scanf("%d", b + i);
  for (i = 0; i < k; i++) {
    for (j = 0; j < k; j++) scanf("%d", &a[i][j]);
  }
  memset(last, -1, sizeof(last));
  for (i = 0; i < n; i++) {
    int now = str[i] - 'A';
    for (j = 0; j < k; j++) {
      if (last[j] == -1) continue;
      if ((zt[j] & (1 << now)) == 0) {
        dp[0][zt[j]] += a[j][now];
        dp[0][zt[j] | (1 << j)] -= a[j][now];
        dp[0][zt[j] | (1 << now)] -= a[j][now];
        dp[0][zt[j] | (1 << j) | (1 << now)] += a[j][now];
      }
      zt[j] |= (1 << now);
    }
    last[now] = i;
    zt[now] = 0;
    st |= (1 << now);
  }
  int now, pre;
  for (now = 1, pre = 0, i = 0; i < k; i++, now = 1 - now, pre = 1 - pre) {
    for (j = 0; j <= st; j++) {
      if (j & (1 << i))
        dp[now][j] = dp[pre][j] + dp[pre][j - (1 << i)];
      else
        dp[now][j] = dp[pre][j];
    }
  }
  int L = (1 << k);
  for (i = 0; i < k; i++) {
    if ((st & (1 << i)) == 0) continue;
    for (j = ((st - 1) & st);; j = ((j - 1) & st)) {
      if (j & (1 << i)) dp[pre][j] += b[i];
      if (!j) break;
    }
  }
  int r = 0;
  for (j = ((st - 1) & st);; j = ((j - 1) & st)) {
    if (dp[pre][j] <= t) r++;
    if (!j) break;
  }
  printf("%d\n", r);
  return 0;
}
