#include <bits/stdc++.h>
using namespace std;
long double distance(long long int i, long long int j, long long int ii,
                     long long int jj) {
  return sqrtf((i - ii) * (i - ii) + (j - jj) * (j - jj));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n, m, x;
  cin >> n >> m >> x;
  char arr[31][31];
  unordered_map<char, bool> umap, normal;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cin >> arr[i][j];
      normal[arr[i][j]] = true;
    }
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (arr[i][j] == 'S') {
        for (long long int ii = 0; ii < n; ii++) {
          for (long long int jj = 0; jj < m; jj++) {
            if (distance(i, j, ii, jj) <= x) {
              umap[arr[ii][jj]] = true;
            }
          }
        }
      }
    }
  }
  long long int q;
  cin >> q;
  string str;
  cin >> str;
  long long int count = 0;
  for (long long int i = 0; i < q; i++) {
    if (normal.find(str[i]) != normal.end() && str[i] >= 'a' && str[i] <= 'z') {
      continue;
    } else if (str[i] >= 'A' && str[i] <= 'Z' && umap[tolower(str[i])] != 0) {
      continue;
    } else if (str[i] >= 'A' && str[i] <= 'Z' && normal[tolower(str[i])] != 0) {
      count += 1;
    } else {
      cout << -1 << "\n";
      return 0;
    }
  }
  if (umap['S'] == 0 && count > 0) {
    cout << -1 << "\n";
    return 0;
  }
  cout << count << "\n";
  return 0;
}
