#include <bits/stdc++.h>
using namespace std;
int sqr(int x) { return x * x; }
bool possible(pair<int, int> a, pair<int, int> b, int threshold) {
  return sqr(a.first - b.first) + sqr(a.second - b.second) <= sqr(threshold);
}
int main() {
  int n, m, x, len;
  char key[30][30];
  cin >> n >> m >> x;
  for (int _n(n), i(0); i < _n; i++)
    for (int _n(m), j(0); j < _n; j++) cin >> key[i][j];
  cin >> len;
  vector<pair<int, int> > pos[256];
  for (int _n(n), i(0); i < _n; i++)
    for (int _n(m), j(0); j < _n; j++)
      pos[key[i][j]].push_back(make_pair(i, j));
  bool valid[256];
  bool need_second_arm[256];
  memset((valid), (0), sizeof(valid));
  memset((need_second_arm), (0), sizeof(need_second_arm));
  for (int _n(256), c(0); c < _n; c++)
    if (isalpha(char(c))) {
      const char C = char(c);
      bool &ok = valid[C];
      bool &used_second_arm = need_second_arm[C];
      ok = true;
      used_second_arm = false;
      if (pos[C].size() == 0 || C == 'S') {
        char uC = toupper(C);
        char lC = tolower(C);
        if (uC == C && pos[lC].size() == 0) {
          ok = false;
        } else if (uC == C) {
          if (pos['S'].size() == 0) {
            ok = false;
          } else {
            bool can = false;
            for (int _n(pos['S'].size()), i(0); i < _n; i++)
              for (int _n(pos[lC].size()), j(0); j < _n; j++) {
                if (possible(pos[lC][j], pos['S'][i], x)) {
                  can = true;
                }
              }
            if (!can) used_second_arm = true;
          }
        } else if (lC == C) {
          if (pos[C].size() == 0) ok = false;
        }
      }
    }
  int cnt = 0;
  for (int _n(len), iter(0); iter < _n; iter++) {
    char C;
    cin >> C;
    if (valid[C]) {
      cnt += need_second_arm[C];
    } else {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << cnt << endl;
  return 0;
}
