#include <bits/stdc++.h>
using namespace std;
const int fx[] = {+1, -1, +0, +0}, fy[] = {+0, +0, +1, -1};
const long long mod = 1e9 + 7, INF = 1e18, mx = 200000;
int Case = 1, cas = 0;
struct R {
  int x, y;
};
int distance(int x1, int y1, int x2, int y2) {
  return ceil(sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
}
int main() {
  int n, m, l;
  scanf("%d %d %d", &n, &m, &l);
  vector<R> shift;
  vector<R> letter[30];
  char key[n + 5][m + 5];
  int f = 1, have[200] = {0}, dis[30], ans = 0;
  for (int i = 0; i < n; i++) {
    scanf("%s", key[i]);
    for (int j = 0; j < m; j++) {
      have[key[i][j]] = 1;
      if (key[i][j] == 'S')
        shift.push_back({i, j});
      else
        letter[key[i][j] - 'a'].push_back({i, j});
    }
  }
  for (int i = 0; i < 26; i++) {
    int mn = 1e9;
    for (int j = 0; j < letter[i].size(); j++)
      for (int k = 0; k < shift.size(); k++)
        mn = min(mn, distance(letter[i][j].x, letter[i][j].y, shift[k].x,
                              shift[k].y));
    dis[i] = mn;
  }
  char s[500005];
  int q;
  scanf("%d %s", &q, s);
  for (int i = 0; i < q && f; i++) {
    char ch = tolower(s[i]);
    if (isupper(s[i]) && dis[ch - 'a'] > l) ans++;
    char c = s[i];
    if (have['S']) c = tolower(c);
    if (!have[c]) f = 0;
  }
  if (!f)
    return puts("-1");
  else
    printf("%d\n", ans);
}
