#include <bits/stdc++.h>
char s[40][40];
char q[600000];
int flag[500];
int abss(int x) { return x > 0 ? x : -x; }
int main() {
  int n, m, x;
  while (scanf("%d %d %d", &n, &m, &x) == 3) {
    for (int i = 0; i < n; i++) scanf("%s", s[i]);
    memset(flag, 0, sizeof(flag));
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) flag[s[i][j]] = 1;
    }
    bool flags = flag['S'];
    if (flag['S']) {
      flag['S'] = 0;
      for (int i = 'A'; i <= 'Z'; i++)
        if (flag[i - 'A' + 'a'] == 1) {
          for (int j = 0; j < n; j++)
            for (int k = 0; k < m; k++)
              if (s[j][k] == i - 'A' + 'a') {
                for (int jj = 0; jj < n; jj++)
                  for (int kk = 0; kk < m; kk++)
                    if (s[jj][kk] == 'S' &&
                        (jj - j) * (jj - j) + (kk - k) * (kk - k) <= x * x)
                      flag[i] = 1;
              }
        }
    }
    int len;
    scanf("%d", &len);
    scanf("%s", q);
    int ans = 0;
    bool ansflag = 1;
    for (int i = 0; i < len; i++) {
      if (q[i] >= 'a' && q[i] <= 'z') {
        if (flag[q[i]] == 0) ansflag = 0;
      } else if (flag[q[i]] == 0 && flag[q[i] - 'A' + 'a'] == 0)
        ansflag = 0;
      else if (flag[q[i]] == 0) {
        ans++;
      }
    }
    if (ansflag == 0 || (ans && flags == 0)) ans = -1;
    printf("%d\n", ans);
  }
}
