#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, x;
  cin >> n >> m >> x;
  vector<string> kb(n);
  for (int i = 0; i < (int)(n); i++) cin >> kb[i];
  vector<pair<int, int>> shifts;
  vector<bool> can_lc(26), can_uc(26);
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(m); j++) {
      if (kb[i][j] == 'S')
        shifts.push_back({i, j});
      else
        can_lc[kb[i][j] - 'a'] = true;
    }
  }
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(m); j++) {
      if (kb[i][j] != 'S') {
        for (auto p : shifts) {
          if ((i - p.first) * (i - p.first) + (j - p.second) * (j - p.second) <=
              x * x)
            can_uc[kb[i][j] - 'a'] = true;
        }
      }
    }
  }
  int q;
  cin >> q;
  string t;
  cin >> t;
  int ans = 0;
  for (char c : t) {
    if ('a' <= c && c <= 'z') {
      if (!can_lc[c - 'a']) {
        cout << -1 << endl;
        return 0;
      }
    } else {
      if (!can_lc[c - 'A'] || shifts.empty()) {
        cout << -1 << endl;
        return 0;
      } else if (!can_uc[c - 'A']) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
