#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 5;
const double EPS = 1e-16;
const long long INF = 1000000000 + 5;
const int MAXN2 = 2e2 + 5;
char s[100][100];
char s2[MAXN];
int d[1000];
bool visited[1000];
int n, m, x;
bool was[MAXN];
int main() {
  char t;
  scanf("%d%d%d", &n, &m, &x);
  for (int i = 0; i < n; i++) {
    scanf("%1c", &t);
    scanf("%s", s[i]);
  }
  int len;
  scanf("%d", &len);
  scanf("%1c", &t);
  scanf("%s", s2);
  for (int i = 0; i < 1000; i++) {
    d[i] = INF;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int c = s[i][j];
      was[c] = 1;
      if (s[i][j] == 'S') {
        d[c] = 0;
        for (int ii = 0; ii < n; ii++) {
          for (int jj = 0; jj < m; jj++) {
            if (s[ii][jj] != 'S') {
              int to = s[ii][jj];
              int ds = (i - ii) * (i - ii) + (j - jj) * (j - jj);
              if (!was[to] || d[to] > ds) {
                was[to] = true;
                d[to] = ds;
              }
            }
          }
        }
      }
    }
  }
  int ans = 0;
  x *= x;
  for (int i = 0; i < len; i++) {
    int c = s2[i];
    int c2 = c;
    if (s2[i] >= 'A' && s2[i] <= 'Z') {
      c2 = 'a' + s2[i] - 'A';
      if (!was[c2]) {
        printf("-1");
        return 0;
      } else {
        if (!was['S']) {
          printf("-1");
          return 0;
        }
        if (d[c2] > x) {
          ans++;
        }
      }
    } else {
      if (!was[c]) {
        printf("-1");
        return 0;
      }
    }
  }
  cout << ans;
  return 0;
}
