#include <bits/stdc++.h>
using namespace std;
inline int sqr(int x) { return x * x; }
int n, m, max_dist;
int len;
char a[100 + 1][100 + 1];
bool exist[27];
int dist[27];
bool is_upper(char ch) { return ch >= 'A' && ch <= 'Z'; }
char to_lower(char ch) {
  if (!is_upper(ch)) return ch;
  return (ch - 'A') + 'a';
}
int main() {
  scanf("%d%d%d\n", &n, &m, &max_dist);
  max_dist *= max_dist;
  memset(exist, 0, sizeof(exist));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      a[i][j] = getchar();
      if (a[i][j] != 'S') exist[a[i][j] - 'a'] = 1;
    }
    scanf("\n");
  }
  for (int i = 0; i < 26; i++) dist[i] = 2147483647;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == 'S') continue;
      for (int i1 = 1; i1 <= n; i1++)
        for (int j1 = 1; j1 <= m; j1++) {
          if (a[i1][j1] != 'S') continue;
          int cur = sqr(i - i1) + sqr(j - j1);
          if (cur < dist[a[i][j] - 'a']) dist[a[i][j] - 'a'] = cur;
        }
    }
  int ans = 0;
  scanf("%d\n", &len);
  while (len--) {
    char ch = getchar();
    char ch1 = to_lower(ch);
    if (!exist[ch1 - 'a']) {
      printf("-1\n");
      return 0;
    }
    if (is_upper(ch)) {
      if (dist[ch1 - 'a'] >= 2147483647) {
        printf("-1\n");
        return 0;
      }
      ans += (dist[ch1 - 'a'] > max_dist);
    }
  }
  printf("%d\n", ans);
  return 0;
}
