#include <bits/stdc++.h>
using namespace std;
int n, m, x;
vector<string> vs;
double dist[26];
bool pres[26];
int main() {
  for (int i = 0; i < 26; i++) {
    dist[i] = 9999;
  }
  cin >> n >> m >> x;
  string s;
  bool shift = false;
  for (int i = 0; i < n; i++) {
    cin >> s;
    vs.push_back(s);
    for (int j = 0; j < m; j++)
      if (s[j] >= 'a' && s[j] <= 'z') {
        pres[s[j] - 'a'] = true;
      } else {
        shift = true;
      }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < n; k++) {
        for (int l = 0; l < m; l++) {
          if (vs[i][j] >= 'a' && vs[i][j] <= 'z' && vs[k][l] == 'S') {
            dist[vs[i][j] - 'a'] =
                min(dist[vs[i][j] - 'a'], sqrt(pow(i - k, 2) + pow(j - l, 2)));
          }
        }
      }
    }
  }
  int q;
  cin >> q;
  string T;
  cin >> T;
  int ret = 0;
  for (int i = 0; i < q; i++) {
    if (!pres[tolower(T[i]) - 'a']) {
      cout << -1;
      return 0;
    }
    if (T[i] >= 'A' && T[i] <= 'Z' && !shift) {
      cout << -1;
      return 0;
    } else if (T[i] >= 'A' && T[i] <= 'Z') {
      double d = dist[tolower(T[i]) - 'a'];
      if (d > x) ret++;
    }
  }
  cout << ret;
  return 0;
}
