#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, C = 0;
  cin >> n >> m >> x;
  bool v[26] = {};
  bool can_touch[26] = {};
  char a[n][m];
  vector<pair<int, int> > S, t[26];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 'S')
        S.push_back({i, j});
      else {
        v[a[i][j] - 'a'] = 1;
        t[a[i][j] - 'a'].push_back({i, j});
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < t[i].size(); j++) {
      for (int o = 0; o < S.size(); o++) {
        int d =
            ((S[o].first - t[i][j].first) * (S[o].first - t[i][j].first)) +
            ((S[o].second - t[i][j].second) * (S[o].second - t[i][j].second));
        if (x * x >= d) {
          can_touch[i] = 1;
          break;
        }
      }
    }
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    char c;
    cin >> c;
    if (v[tolower(c) - 'a'] == 0) {
      cout << -1 << endl;
      return 0;
    }
    if (isupper(c) && S.size() < 1) {
      cout << -1 << endl;
      return 0;
    }
    if (!can_touch[tolower(c) - 'a'] && isupper(c)) C++;
  }
  cout << C << endl;
  return 0;
}
