#include <bits/stdc++.h>
using namespace std;
int n, m, x, q;
string s;
void solve() {
  cin >> n >> m >> x;
  map<char, vector<pair<int, int>>> kb;
  vector<pair<int, int>> shif;
  char aux;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> aux;
      if (aux != 'S')
        kb[aux].push_back({i, j});
      else
        shif.push_back({i, j});
    }
  }
  cin >> q;
  map<char, int> word;
  for (int i = 0; i < q; i++) {
    cin >> aux, word[aux]++;
    ;
  }
  bool ok = true;
  int cont = 0;
  for (auto it : word) {
    if (kb.count(tolower(it.first))) {
      if (isupper(it.first)) {
        if (shif.size() == 0) {
          ok = false;
          break;
        }
        aux = tolower(it.first);
        bool shi = false;
        for (auto it1 : kb[aux]) {
          for (auto it2 : shif) {
            if ((float)sqrt((float)pow(it1.first - it2.first, 2) +
                            (float)pow(it1.second - it2.second, 2)) > x)
              shi = true;
            else {
              shi = false;
              goto go;
            }
          }
        }
      go:
        if (shi) {
          cont += it.second;
        }
      }
    } else {
      ok = false;
      break;
    }
  }
  if (!ok)
    cout << -1 << "\n";
  else
    cout << cont << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
