#include <bits/stdc++.h>
using namespace std;
const int maxint = 999999999;
int n, m, x, len, ans;
char key[50][50];
char s[5 * 100005];
int d[30];
bool ex[30];
int min(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
int main() {
  int i, j, p, q;
  bool flag;
  while (scanf("%d%d%d", &n, &m, &x) != EOF) {
    ans = 0;
    memset(ex, false, sizeof(ex));
    for (i = 0; i < 26; i++) d[i] = maxint;
    flag = false;
    for (i = 1; i <= n; i++) {
      scanf("%s", key[i]);
      for (j = 0; j < m; j++) {
        if (key[i][j] == 'S') {
          flag = true;
          continue;
        }
        ex[key[i][j] - 'a'] = true;
      }
    }
    for (i = 1; i <= n; i++) {
      for (j = 0; j < m; j++) {
        if (key[i][j] == 'S') {
          for (p = 1; p <= n; p++) {
            for (q = 0; q < m; q++)
              if (key[p][q] != 'S')
                d[key[p][q] - 'a'] = min(d[key[p][q] - 'a'],
                                         (i - p) * (i - p) + (j - q) * (j - q));
          }
        }
      }
    }
    scanf("%d", &len);
    scanf("%s", s);
    bool can = true;
    ;
    for (i = 0; i < len; i++) {
      if (s[i] >= 'A' && s[i] <= 'Z') {
        if (flag == false || ex[s[i] - 'A'] == false) {
          can = false;
          break;
        }
        if (d[s[i] - 'A'] > x * x) {
          ans++;
        }
      } else {
        if (ex[s[i] - 'a'] == false) {
          can = false;
          break;
        }
      }
    }
    if (can == false)
      printf("-1\n");
    else
      printf("%d\n", ans);
  }
  return 0;
}
