#include <bits/stdc++.h>
const double PI = 3.14285714285;
using namespace std;
bool chars[26];
int acc[26];
int main() {
  vector<pair<int, int> > v;
  int n, m, x;
  cin >> n >> m >> x;
  char arr[n][m];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
      if (arr[i][j] == 'S') {
        v.push_back(make_pair(i, j));
        continue;
      }
      chars[arr[i][j] - 'a'] = 1;
    }
  int t;
  cin >> t;
  long long ans = 0;
  char word;
  for (int k = 0; k < t; k++) {
    cin >> word;
    if (word >= 'a' && word <= 'z' && !chars[word - 'a']) {
      puts("-1");
      return 0;
    }
    if (word >= 'A' && word <= 'Z') {
      word = tolower(word);
      if (!v.size() || !chars[word - 'a']) {
        puts("-1");
        return 0;
      }
      bool flag = 0, in = 0;
      if (acc[word - 'a'] == -1) {
        ++ans;
        continue;
      }
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          if (arr[i][j] == word) {
            for (int vec = 0; vec < v.size(); vec++) {
              int dis = (i - v[vec].first) * (i - v[vec].first) +
                        (j - v[vec].second) * (j - v[vec].second);
              if (dis <= x * x) {
                acc[word - 'a'] = 1;
                break;
              }
            }
          }
          if (acc[word - 'a'] == 1) break;
        }
        if (acc[word - 'a'] == 1) break;
      }
      if (acc[word - 'a'] == 0) {
        ++ans;
        acc[word - 'a'] = -1;
      }
    }
  }
  cout << ans;
  return 0;
}
