#include <bits/stdc++.h>
char str[200100];
int data[26], G[26][26], mask[26], total[1 << 22][2];
using namespace std;
int N, K, T, mark;
int DP() {
  mark = 0;
  memset(total, (0), sizeof(total));
  memset(mask, (-1), sizeof(mask));
  for (int i = 0; i < N; i++) {
    int second = 1 << (str[i] - 'A');
    mark |= second;
    for (int j = 0; j < K; j++) {
      int first = 1 << j;
      if (mask[j] == -1) continue;
      if ((mask[j] & second) || (mask[j] & first)) continue;
      total[mask[j]][0] += G[j][str[i] - 'A'];
      total[mask[j] | first][0] -= G[j][str[i] - 'A'];
      total[mask[j] | second][0] -= G[j][str[i] - 'A'];
      total[mask[j] | first | second][0] += G[j][str[i] - 'A'];
    }
    for (int j = 0; j < K; j++) {
      int first = 1 << j;
      if (first == second)
        mask[j] = 0;
      else if (mask[j] != -1)
        mask[j] |= second;
    }
  }
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < 1 << K; j++) {
      total[j | (1 << i)][(i + 1) & 1] += total[j][i & 1];
      if (!((1 << i) & j)) total[j][(i + 1) & 1] += total[j][i & 1];
    }
    for (int j = 0; j < 1 << K; j++) total[j][i & 1] = 0;
  }
  int ans = 0;
  for (int i = 0; i < (1 << K) - 1; i++) {
    if ((~mark) & i) continue;
    bool real = false;
    for (int j = 0; j < K; j++) {
      if ((mark & (1 << j) && (i & (1 << j)))) total[i][K & 1] += data[j];
      if ((mark & (1 << j)) && (!(i & (1 << j)))) real = true;
    }
    if (total[i][K & 1] <= T && real) {
      ans++;
    }
  }
  return ans;
}
int main() {
  while (cin >> N >> K >> T) {
    cin >> str;
    for (int i = 0; i < K; i++) scanf("%d", &data[i]);
    for (int i = 0; i < K; i++)
      for (int j = 0; j < K; j++) scanf("%d", &G[i][j]);
    cout << DP() << endl;
  }
}
