#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x;
  cin >> n >> m >> x;
  char a[34][34];
  vector<pair<int, int> > v;
  map<int, bool> p;
  map<int, bool> r;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      r[a[i][j]] = true;
      if (a[i][j] == 'S') v.push_back(make_pair(i, j));
    }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] != 'S') {
        for (int q = 0; q < v.size(); q++) {
          int u = (abs(v[q].first - i)), hz = abs(v[q].second - j);
          u *= u;
          hz *= hz;
          if (u + hz <= x * x) {
            p[a[i][j]] = true;
            break;
          }
        }
      }
    }
  }
  int z;
  cin >> z;
  string s;
  cin >> s;
  int ans = 0;
  int w = 'a' - 'A';
  for (int i = 0; i < z; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      if (v.size() == 0) {
        cout << -1;
        return 0;
      }
      char c = tolower(s[i]);
      if (!r[c]) {
        cout << -1;
        return 0;
      } else if (!p[c])
        ans++;
    } else {
      if (!r[s[i]]) {
        cout << -1;
        return 0;
      }
    }
  }
  cout << ans;
}
