#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > sym[30];
vector<pair<int, int> > shift;
set<int> meet1;
vector<int> meet;
int cnt[30];
char str[(int)1e5 * 5 + 5];
bool used[30];
bool hshift;
inline int Times(int num) { return num * num; }
int main() {
  int n, m, x;
  scanf("%d%d%d", &n, &m, &x);
  char key;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      key = getchar();
      if (key == '\n') key = getchar();
      if (key != 'S') {
        used[(int)(key - 'a' + 1)] = true;
        sym[(int)(key - 'a' + 1)].push_back(make_pair(i, j));
      } else {
        shift.push_back(make_pair(i, j));
        hshift = true;
      }
    }
  int len;
  scanf("%d", &len);
  getchar();
  bool judge = true;
  for (int i = 1; i <= len; i++) {
    scanf("%c", &str[i]);
    if (str[i] <= 'Z')
      if (hshift && used[(int)(str[i] - 'A' + 1)]) {
        meet1.insert((int)(str[i] - 'A' + 1));
        cnt[(int)(str[i] - 'A' + 1)]++;
      } else
        judge = false;
    else if (!used[(int)(str[i] - 'a' + 1)])
      judge = false;
  }
  if (!judge) {
    printf("%d\n", -1);
    return 0;
  }
  for (set<int>::iterator it = meet1.begin(); it != meet1.end(); it++)
    meet.push_back(*it);
  int ans = 0;
  int cur, dis;
  pair<int, int> keyb, sshift;
  for (int i = 0; i < meet.size(); i++) {
    judge = false;
    cur = meet[i];
    for (int j = 0; j < sym[cur].size() && !judge; j++) {
      keyb = sym[cur][j];
      for (int k = 0; k < shift.size(); k++) {
        sshift = shift[k];
        if (Times(abs(keyb.first - sshift.first)) +
                Times(abs(keyb.second - sshift.second)) <=
            Times(x)) {
          judge = true;
          break;
        }
      }
    }
    if (!judge) ans += cnt[cur];
  }
  printf("%d\n", ans);
  return 0;
}
