#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int ii;
  int jj;
} ky;
int carre(int a) { return a * a; }
int main(int argc, char **argv) {
  int tst, n, m, x, j, k;
  bool ttt = false;
  char car;
  long long N, i, res;
  res = 0;
  vector<ky> tab[27];
  ky tmp;
  cin >> n >> m >> x;
  getchar();
  double dist, taab[n][m], min;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      taab[i][j] = -1;
      cin >> car;
      tmp.ii = i;
      tmp.jj = j;
      if (car == 'S') {
        taab[i][j] = 0;
        tab[0].push_back(tmp);
      } else
        tab[((int)car) - 96].push_back(tmp);
    }
    getchar();
  }
  for (k = 0; k < tab[0].size(); k++) {
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        min = sqrt(carre(tab[0][k].ii - i) + carre(tab[0][k].jj - j));
        if (taab[i][j] == -1 || taab[i][j] > min) taab[i][j] = min;
      }
    }
  }
  cin >> N;
  getchar();
  for (i = 0; i < N; i++) {
    tst = 0;
    cin >> car;
    if (car <= 'Z') {
      car = car - 'A' + 'a';
      tst = 1;
    }
    if (tab[((int)car) - 96].size() == 0) {
      ttt = true;
      break;
    }
    if (tst) {
      if (!tab[0].size()) {
        ttt = true;
        break;
      }
      for (k = 0; k < tab[(int)car - 96].size() &&
                  taab[tab[(int)car - 96][k].ii][tab[(int)car - 96][k].jj] > x;
           k++)
        ;
      if (k == tab[(int)car - 96].size()) res++;
    }
  }
  if (ttt)
    cout << -1;
  else
    cout << res;
}
