#include <bits/stdc++.h>
using namespace std;
int distance(int x1, int y1, int x2, int y2);
char s[35][35];
vector<pair<int, int> > shiftPosition;
bool isShiftExist;
bool small[26];
bool capital[26];
int main() {
  int n, m, x, count = 0;
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> s[i][j];
      if (s[i][j] == 'S') {
        isShiftExist = true;
        shiftPosition.push_back(make_pair(i, j));
      }
    }
  }
  int l = shiftPosition.size();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i][j] != 'S') {
        small[s[i][j] - 97] = true;
        if (!capital[s[i][j] - 32 - 'A']) {
          for (int k = 0; k < l; k++) {
            int val =
                distance(shiftPosition[k].first, shiftPosition[k].second, i, j);
            if (val <= x * x) {
              capital[s[i][j] - 32 - 'A'] = true;
              break;
            }
          }
        }
      }
    }
  }
  int q;
  cin >> q;
  string text;
  cin >> text;
  for (int i = 0; i < q; i++) {
    if (text[i] >= 'a' && text[i] <= 'z' && !small[text[i] - 97]) {
      cout << -1 << endl;
      return 0;
    }
    if (text[i] >= 'A' && text[i] <= 'Z' &&
        (!small[text[i] + 32 - 97] || !isShiftExist)) {
      cout << -1;
      return 0;
    }
    if (text[i] >= 'A' && text[i] <= 'Z' && small[text[i] + 32 - 97] &&
        isShiftExist && !capital[text[i] - 65]) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
int distance(int x1, int y1, int x2, int y2) {
  return (((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
