#include <bits/stdc++.h>
using namespace std;
string a[30];
string s;
bool p[26];
bool u[26];
vector<pair<int, int> > pi[26];
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, x;
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++) cin >> a[i];
  int l;
  cin >> l;
  cin >> s;
  bool si = false;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] != 'S') {
        p[a[i][j] - 'a'] = 1;
        pi[a[i][j] - 'a'].push_back(make_pair(i, j));
      } else
        si = true;
    }
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < pi[i].size(); j++) {
      for (int ki = 0; ki < n; ki++) {
        for (int kj = 0; kj < m; kj++) {
          if (a[ki][kj] == 'S' &&
              x * x >= (ki - pi[i][j].first) * (ki - pi[i][j].first) +
                           (kj - pi[i][j].second) * (kj - pi[i][j].second)) {
            u[i] = true;
            goto don;
          }
        }
      }
    }
  don:;
  }
  for (int i = 0; i < 26; i++) {
  }
  int tot = 0;
  for (int i = 0; i < l; i++) {
    if (s[i] <= 'Z') {
      if ((!si) || (!p[s[i] - 'A'])) {
        cout << "-1" << endl;
        return 0;
      } else if (!u[s[i] - 'A'])
        tot++;
    } else {
      if (!p[s[i] - 'a']) {
        cout << "-1" << endl;
        return 0;
      }
    }
  }
  cout << tot << endl;
  return 0;
}
