#include <bits/stdc++.h>
using namespace std;
int N, K;
char buf[200010];
int t[30], a[30][30];
long long score[(1 << 22)];
int sz, last[30];
void func(void) {
  int i, j, k;
  sz = 0;
  for (i = N - 1; i >= 0; i--) {
    int x = buf[i] - 'A';
    int mid = 0;
    for ((j) = 0; (j) < (int)(sz); (j)++) {
      int y = last[j];
      score[mid] += a[x][y];
      score[mid | (1 << x)] -= a[x][y];
      score[mid | (1 << y)] -= a[x][y];
      score[mid | (1 << x) | (1 << y)] += a[x][y];
      if (y == x) break;
      mid |= (1 << y);
    }
    for ((j) = 0; (j) < (int)(sz); (j)++)
      if (last[j] == x) break;
    if (j == sz) sz++;
    for (k = j - 1; k >= 0; k--) last[k + 1] = last[k];
    last[0] = x;
  }
}
int main(void) {
  int T, i, j;
  scanf("%d%d%d", &N, &K, &T);
  scanf("%s", buf);
  for ((i) = 0; (i) < (int)(K); (i)++) scanf("%d", &t[i]);
  for ((i) = 0; (i) < (int)(K); (i)++)
    for ((j) = 0; (j) < (int)(K); (j)++) scanf("%d", &a[i][j]);
  func();
  for ((i) = 0; (i) < (int)(K); (i)++) {
    int two = (1 << i);
    for ((j) = 0; (j) < (int)((1 << K)); (j)++)
      if (j < (j ^ two)) score[j ^ two] += score[j];
  }
  int exist = 0;
  for ((i) = 0; (i) < (int)(N); (i)++) exist |= (1 << (buf[i] - 'A'));
  for ((i) = 0; (i) < (int)(K); (i)++)
    if (exist & (1 << i))
      for ((j) = 0; (j) < (int)((1 << K)); (j)++)
        if (j & (1 << i)) score[j] += t[i];
  int ans = 0;
  for ((i) = 0; (i) < (int)((1 << K)); (i)++) {
    int mask = (1 << K) - 1 - i;
    if (mask != 0 && (exist & mask) == mask)
      if (score[i] <= T) ans++;
  }
  cout << ans << endl;
  return 0;
}
