#include <bits/stdc++.h>
using namespace std;
long long M = 1e9 + 7;
const int N = (1 << 22) + 7;
long long n, k, lim;
long long cst[30], a[30][30];
string s;
long long dp[N], lst[30];
long long cnt[N];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> lim;
  cin >> s;
  for (long long i = 0; i < k; i++) cin >> cst[i];
  for (long long i = 0; i < k; i++)
    for (long long j = 0; j < k; j++) cin >> a[i][j];
  long long plc = 0;
  set<pair<long long, long long> > st;
  for (auto c : s) {
    long long v = c - 'A';
    cnt[v]++;
    plc++;
    long long del = 0;
    for (auto p : st) {
      long long u = p.second;
      if (u == v) {
        dp[del] += a[v][v];
        dp[del ^ (1 << v)] -= a[v][v];
        break;
      } else {
        dp[del] += a[u][v];
        dp[del ^ (1 << u)] -= a[u][v];
        dp[del ^ (1 << v)] -= a[u][v];
        dp[del ^ (1 << v) ^ (1 << u)] += a[u][v];
        del ^= (1 << u);
      }
    }
    st.erase({-lst[v], v});
    lst[v] = plc;
    st.insert({-lst[v], v});
  }
  for (long long j = 0; j < k; j++)
    for (long long msk = 0; msk < (1 << k); msk++)
      if ((msk >> j) & 1) dp[msk] += dp[msk ^ (1 << j)];
  long long res = 0;
  for (long long msk = 0; msk < (1 << k); msk++) {
    long long sz = s.size();
    for (long long j = 0; j < k; j++)
      if ((msk >> j) & 1) {
        dp[msk] += cst[j];
        if (!cnt[j]) dp[msk] = 1e15;
      }
    if (dp[msk] <= lim) res++;
  }
  cout << res - 1;
}
