#include <bits/stdc++.h>
using namespace std;
int N, K, T, a[22][22], t[22];
char s[200010], q[22], l;
int c[1 << 22];
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> K >> T >> s;
  for (int i = 0; i < K; i++) cin >> t[i];
  for (int i = 0; i < K; i++)
    for (int j = 0; j < K; j++) cin >> a[i][j];
  for (int i = 0; i < N; i++) {
    int j, p = s[i] - 'A', f = 0;
    for (j = 0; j < l; j++) {
      int o = q[j];
      c[f] += a[o][p];
      c[f | (1 << o)] -= a[o][p];
      c[f | (1 << p)] -= a[o][p];
      c[f | (1 << o) | (1 << p)] += a[o][p];
      if (o == p) break;
      f |= (1 << o);
    }
    if (j == l) l++;
    for (; j; j--) q[j] = q[j - 1];
    q[0] = p;
  }
  int w = 0, ans = 0;
  for (int i = 0; i < N; i++) w |= (1 << s[i] - 'A');
  for (int j = 0; j < K; j++)
    for (int i = 0; i < 1 << K; i++)
      if (i & (1 << j)) c[i] += c[i ^ (1 << j)];
  for (int i = 0; i < 1 << K; i++)
    for (int j = 0; j < K; j++)
      if ((w & i) & (1 << j)) c[i] += t[j];
  for (int i = 0; i < (1 << K) - 1; i++)
    if (i != w && (i & w) == i && c[i] <= T) ans++;
  cout << ans << endl;
  return 0;
}
