#include <bits/stdc++.h>
using namespace std;
int n, m, x;
int minDist[60];
bool letters[60];
char keyboard[35][35];
bool shift = false;
bool isUppercase(char x) { return x >= 'A' && x <= 'Z'; }
double euclidean(int x1, int y1, int x2, int y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  memset(letters, false, sizeof letters);
  for (int i = 0; i < 60; i++) {
    minDist[i] = 1e9;
  }
  scanf("%d %d %d\n", &n, &m, &x);
  x *= x;
  for (int i = 0; i < n; i++) gets(keyboard[i]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (keyboard[i][j] == 'S') {
        shift = true;
        for (int k = 0; k < n; k++) {
          for (int l = 0; l < m; l++) {
            if (keyboard[k][l] != 'S') {
              minDist[keyboard[k][l] - 'A'] =
                  min(minDist[keyboard[k][l] - 'A'],
                      (i - k) * (i - k) + (j - l) * (j - l));
            }
          }
        }
      } else
        letters[keyboard[i][j] - 'A'] = true;
    }
  }
  int ans = 0;
  int q;
  scanf("%d\n", &q);
  string query;
  cin >> query;
  for (int i = 0; i < q; i++) {
    if (isUppercase(query[i])) {
      if (!shift) {
        printf("-1\n");
        return 0;
      }
      if (!letters[query[i] + 32 - 'A']) {
        printf("-1\n");
        return 0;
      }
      if (minDist[query[i] + 32 - 'A'] > x) ans++;
    } else {
      if (!letters[query[i] - 'A']) {
        printf("-1\n");
        return 0;
      }
    }
  }
  printf("%d\n", ans);
}
