#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m, x;
  int i, j, p, q;
  cin >> n >> m >> x;
  char kb[n][m];
  double dist[26];
  bool exist[26];
  string str;
  int ret = 0;
  memset(exist, false, sizeof(exist));
  for (i = 0; i < 26; i++) dist[i] = 65535;
  for (i = 0; i < n; i++) {
    cin >> str;
    for (j = 0; j < m; j++) {
      kb[i][j] = str[j];
      if (kb[i][j] != 'S') exist[kb[i][j] - 'a'] = true;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (kb[i][j] == 'S') {
        for (p = 0; p < n; p++) {
          for (q = 0; q < m; q++) {
            dist[kb[p][q] - 'a'] =
                min(dist[kb[p][q] - 'a'],
                    sqrt((p - i) * (p - i) + (q - j) * (q - j)));
          }
        }
      }
    }
  }
  cin >> n;
  cin >> str;
  for (i = 0; i < n; i++) {
    if ('a' <= str[i] && str[i] <= 'z') {
      if (exist[str[i] - 'a'] == true) {
      } else {
        cout << -1 << endl;
        return 0;
      }
    } else {
      if (exist[str[i] + 32 - 'a'] == false ||
          dist[str[i] + 32 - 'a'] == 65535) {
        cout << -1 << endl;
        return 0;
      } else if (dist[str[i] + 32 - 'a'] > x) {
        ret++;
      } else {
      }
    }
  }
  cout << ret << endl;
  return 0;
}
