#include <bits/stdc++.h>
using namespace std;
char a[55][55];
int n, m, x;
int dist(int p, int q, int r, int s) {
  return (p - r) * (p - r) + (q - s) * (q - s);
}
int ok[128] = {}, appear[128] = {};
char s[1000000];
int main(void) {
  scanf("%d%d%d", &n, &m, &x);
  for (int i = 0; i < n; i++) scanf("%s", a[i]);
  int S = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] == 'S') {
        S = 1;
        for (int u = 0; u < n; u++)
          for (int v = 0; v < m; v++)
            if (dist(i, j, u, v) <= x * x) {
              ok[(int)a[u][v]] = 1;
            }
      } else
        appear[(int)a[i][j]] = 1;
  scanf("%d", &n);
  scanf("%s", s);
  int ans = 0, f = 0;
  for (int i = 0; s[i]; i++)
    if (s[i] >= 'A' && s[i] <= 'Z') {
      if (!S || !appear[s[i] + 32]) f = 1;
      ans += !ok[s[i] + 32];
    } else if (!appear[(int)s[i]])
      f = 1;
  if (f) ans = -1;
  printf("%d\n", ans);
  return 0;
}
