#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  int n, m, q, c = 0;
  double x;
  cin >> n >> m >> x;
  string t, a[n];
  map<char, int> v;
  vector<pair<int, int> > si;
  vector<double> all(26, INT_MAX);
  bool f = false;
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> q >> t;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      v[a[i][j]]++;
      if (a[i][j] == 'S') si.push_back(make_pair(i, j));
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 'S') continue;
      for (unsigned int k = 0; k < si.size(); k++) {
        double dis = sqrt(pow(si[k].first - i, 2) + pow(si[k].second - j, 2));
        if (all[a[i][j] - 'a'] > dis) all[a[i][j] - 'a'] = dis;
      }
    }
  for (int i = 0; i < q; i++) {
    if (t[i] < 'a') f = true;
    if ((v['S'] < 1 && f) || (t[i] >= 'a' && v[t[i]] < 1) ||
        (t[i] < 'a' && v[t[i] + 32] < 1)) {
      cout << "-1\n";
      return 0;
    }
    if (t[i] >= 'a') continue;
    if (all[t[i] + 32 - 'a'] > x) c++;
  }
  cout << c << endl;
  return 0;
}
