#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int n, k, T, all, t[105], w[105][105], lst[105], id[105];
char s[maxn];
long long f[1 << 22];
inline bool cmp(const int &x, const int &y) { return lst[x] < lst[y]; }
int main() {
  scanf("%d%d%d%s", &n, &k, &T, s + 1);
  for (int i = 0; i < k; i++) scanf("%d", &t[i]);
  for (int i = 0; i < k; i++)
    for (int j = 0; j < k; j++) scanf("%d", &w[i][j]);
  for (int i = 0; i < k; i++) lst[i] = n + 1;
  for (int i = n; i >= 1; i--) {
    for (int j = 0; j < k; j++) id[j] = j;
    sort(id, id + k, cmp);
    int now = 0, ch = s[i] - 'A';
    for (int j = 0; j < k; j++) {
      if (lst[id[j]] > n) break;
      f[now] += w[ch][id[j]];
      f[now | (1 << ch)] -= w[ch][id[j]];
      f[now | (1 << id[j])] -= w[ch][id[j]];
      f[now | (1 << ch) | (1 << id[j])] += w[ch][id[j]];
      if (ch == id[j]) break;
      now |= (1 << id[j]);
    }
    lst[ch] = i;
  }
  for (int j = 0; j < k; j++)
    for (int i = 0; i < (1 << k); i++)
      if (i & (1 << j)) f[i] += f[i ^ (1 << j)];
  for (int i = 1; i <= n; i++) all |= (1 << (s[i] - 'A'));
  int ans = 0;
  for (int i = 0; i < (1 << k) - 1; i++) {
    for (int j = 0; j < k; j++)
      if (i & (1 << j)) f[i] += t[j];
    if ((i & all) == i && i != all && f[i] <= T) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
