#include <bits/stdc++.h>
using namespace std;
char arr[31][31];
int n, m, x;
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  srand(time(NULL));
  cin >> n >> m >> x;
  map<char, int> m1;
  vector<pair<float, float> > v;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
      m1[arr[i][j]]++;
      if (arr[i][j] == 'S') v.push_back(make_pair(i, j));
    }
  }
  int q;
  cin >> q;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] >= 65 && s[i] < 91 && !m1['S'] ||
        !m1[s[i]] && s[i] >= 97 && s[i] < 123 || s[i] == 'S' && !m1['s']) {
      cout << "-1";
      return 0;
    }
  }
  int q1 = 0;
  map<char, int> ss;
  for (int i = 0; i < s.size(); i++) {
    int ans = 1000;
    if (s[i] >= 65 && s[i] < 91) {
      if (ss[s[i]] == 2)
        q1++;
      else if (ss[s[i]] == 1)
        continue;
      else {
        s[i] += 32;
        bool f = 0;
        if (!m1[s[i]]) {
          cout << -1 << endl;
          return 0;
        }
        for (int j = 0; j < n; j++) {
          for (int k = 0; k < m; k++) {
            if (arr[j][k] == s[i]) {
              for (int l = 0; l < v.size(); l++) {
                if ((v[l].first - j) * (v[l].first - j) +
                        (v[l].second - k) * (v[l].second - k) <=
                    x * x) {
                  f = 1;
                  break;
                }
              }
            }
          }
        }
        if (!f) {
          q1++;
          ss[s[i] - 32] = 2;
        } else
          ss[s[i] - 32] = 1;
      }
    }
  }
  cout << q1 << endl;
}
