#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  map<char, int> m;
  string s[50], t;
  vector<pair<int, int> > v;
  int n, y, k, val;
  cin >> n >> y >> k;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < y; ++j) {
      if (s[i][j] == 'S')
        v.push_back({i, j});
      else
        m[s[i][j]] = k;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < y; ++j) {
      if (s[i][j] == 'S') continue;
      for (auto g : v) {
        val = (g.first - i) * (g.first - i) + (g.second - j) * (g.second - j);
        if (k * k >= val) {
          m[toupper(s[i][j])] = k;
        } else {
          if (m[toupper(s[i][j])] != k) m[toupper(s[i][j])] = k + 1;
        }
      }
    }
  }
  int q, cnt = 0;
  cin >> q;
  cin >> t;
  for (int i = 0; i < q; ++i) {
    if (m[t[i]] == 0) {
      cout << -1;
      return 0;
    } else {
      if (m[t[i]] == k + 1) cnt++;
    }
  }
  cout << cnt;
  return 0;
}
