#include <bits/stdc++.h>
int d(int x, int y, int z) {
  return ceil(sqrt((x / z - y / z) * (x / z - y / z) +
                   (x % z - y % z) * (x % z - y % z)));
}
int main() {
  char c;
  int r = 0, x, y, z, w, alpha[26][999], alidx[26] = {0}, shidx = 0, shift[999];
  int res[26] = {0};
  scanf("%d %d %d\n", &x, &y, &z);
  for (int i = 0, j = 0; i < x; ++i, scanf("\n"))
    for (j = 0; j < y; ++j) {
      scanf("%c", &c);
      if (c != 'S')
        alpha[c - 'a'][alidx[c - 'a']++] = i * y + j;
      else
        shift[shidx++] = i * y + j;
    }
  for (int i = 0; i < 26; ++i) {
    int hand = 1;
    int l = alidx[i];
    if (l == 0 || shidx == 0)
      hand = -1;
    else
      for (int ch = 0; ch < l; ++ch)
        for (int sh = 0; sh < shidx; ++sh)
          if (d(alpha[i][ch], shift[sh], y) <= z) {
            sh = shidx;
            ch = l;
            hand = 0;
          }
    res[i] = hand;
  }
  scanf("%d\n", &w);
  for (int i = 0; i < w; ++i) {
    scanf("%c", &c);
    if (c >= 'A' && c <= 'Z') {
      if (res[c - 'A'] == -1)
        return (printf("-1\n", c)), 0;
      else if (res[c - 'A'] > 0)
        r++;
    } else if (alidx[c - 'a'] == 0)
      return (printf("-1\n")), 0;
  }
  printf("%d\n", r);
  return 0;
}
