#include <bits/stdc++.h>
using namespace std;
const int N = 26;
vector<pair<int, int> > a[N];
bool Can[N];
int xx[905], yy[905];
int dis(int x, int y, int xx, int yy) {
  return (x - xx) * (x - xx) + (y - yy) * (y - yy);
}
char s[(int)5e5 + 7];
int main() {
  int n, m, x;
  scanf("%d %d %d", &n, &m, &x);
  int len = 0;
  for (int i = 0; i < n; i++) {
    scanf("%s", &s);
    for (int j = 0; j < m; j++) {
      char c;
      c = s[j];
      if (c == 'S') {
        xx[len] = i, yy[len++] = j;
        continue;
      }
      a[c - 'a'].push_back(make_pair(i, j));
    }
  }
  for (int i = 0; i < len; i++) {
    for (int j = 0; j < N; j++) {
      if (Can[j]) continue;
      for (int k = 0; k < a[j].size(); k++) {
        if (dis(a[j][k].first, a[j][k].second, xx[i], yy[i]) <= x * x) {
          Can[j] = 1;
          break;
        }
      }
    }
  }
  int q;
  scanf("%d", &q);
  int ans = 0;
  scanf("%s", &s);
  for (int i = 0; i < q; i++) {
    char c = s[i];
    if ((c >= 'A' && c <= 'Z' && (!len || a[c - 'A'].size() == 0))) {
      return puts("-1"), 0;
    }
    if (c >= 'A' && c <= 'Z' && !Can[c - 'A']) {
      ans++;
    } else if (c >= 'a' && c <= 'z') {
      if (a[c - 'a'].size() == 0) {
        return puts("-1"), 0;
      }
    }
  }
  printf("%d", ans);
}
