#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<long long, long long>>> t;
bool visited[55];
vector<pair<long long, long long>> v;
int of[105];
int main() {
  double nb, i, n, q, m, x, j, dis, mi = 10e9, k;
  t.resize(105);
  string s;
  cin >> n >> m >> x;
  for (i = 0; i < n; i++) {
    cin >> s;
    for (j = 0; j < m; j++) {
      if (s[j] != 'S') {
        t[s[j] - 'a'].push_back(make_pair(i, j));
        visited[s[j] - 'a'] = 1;
      } else {
        v.push_back(make_pair(i, j));
        visited[50] = 1;
      }
    }
  }
  cin >> q;
  cin >> s;
  nb = 0;
  for (i = 0; i < q; i++) {
    int test = 0;
    mi = 10e9;
    char s1 = (char)tolower(s[i]);
    if (visited[s1 - 'a']) {
      if (s[i] >= 'A' && s[i] <= 'Z') {
        if (visited[50]) {
          if (of[s1 - 'a'] == 1) {
            continue;
          } else if (of[s1 - 'a'] == 2) {
            nb++;
          } else {
            for (j = 0; j < v.size(); j++) {
              for (k = 0; k < t[s1 - 'a'].size(); k++) {
                dis = (double)sqrt(
                    (double)pow(t[s1 - 'a'][k].first - v[j].first, 2) +
                    (double)pow(t[s1 - 'a'][k].second - v[j].second, 2));
                mi = (double)min(dis, mi);
              }
              if (mi <= x) {
                of[s1 - 'a'] = 1;
                test = 1;
                break;
              }
              if (test) break;
            }
            if ((double)mi > (double)x) {
              nb++;
              of[s1 - 'a'] = 2;
            }
          }
        } else {
          cout << -1;
          return 0;
        }
      }
    } else {
      cout << -1;
      return 0;
    }
  }
  cout << nb;
}
