#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  long long int n, m, x, i, j, i1, l, s = 0;
  string t;
  cin >> n >> m >> x;
  vector<vector<char>> k(n, vector<char>(m));
  vector<pair<long long int, long long int>> pairs;
  unordered_map<char, bool> keys;
  for (i = 0; i <= n - 1; ++i)
    for (j = 0; j <= m - 1; ++j) {
      cin >> k[i][j];
      if (!(keys.find(k[i][j]) != keys.end()))
        keys.insert(make_pair(k[i][j], true));
      if (k[i][j] == 'S') {
        ++s;
        pairs.push_back(make_pair(i, j));
      }
    }
  cin >> l >> t;
  vector<double> ch(26, INT_MAX);
  for (i = 0; i <= n - 1; ++i) {
    for (j = 0; j <= m - 1; ++j) {
      double d = 0, md = INT_MAX;
      for (i1 = 0; i1 <= s - 1; ++i1) {
        d = (pairs[i1].first - i) * (pairs[i1].first - i) +
            (pairs[i1].second - j) * (pairs[i1].second - j);
        md = min(md, d);
      }
      ch[k[i][j] - 'a'] = min(sqrt(md), ch[k[i][j] - 'a']);
    }
  }
  bool possible = true;
  long long int ans = 0;
  for (i = 0; i <= l - 1; ++i) {
    char c = t[i];
    if (isupper(t[i])) c = t[i] + 32;
    if ((isupper(t[i]) and !s) or !(keys.find(c) != keys.end())) {
      possible = false;
      break;
    }
    if (isupper(t[i]) and ch[c - 'a'] > x) ++ans;
  }
  if (!possible)
    cout << "-1\n";
  else
    cout << ans << '\n';
  return 0;
}
