#include <bits/stdc++.h>
using namespace std;
bool isupper(char a) {
  if (a >= 'A' && a <= 'Z') return true;
  return false;
}
int main() {
  bool shift[35][35] = {false};
  string str;
  int n, m, d;
  int q;
  string arr[35];
  bool low[27] = {false}, cap[27] = {false};
  cin >> n >> m >> d;
  bool S = false;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      low[arr[i][j] - 'a'] = true;
      if (cap[arr[i][j] - 'a'] == false)
        for (int x = 0; x < n; x++)
          for (int y = 0; y < m; y++) {
            if (arr[x][y] == 'S') {
              S = true;
              if (sqrt((i - x) * (i - x) + (j - y) * (j - y)) <= d) {
                cap[arr[i][j] - 'a'] = true;
              }
            }
          }
    }
  cin >> q;
  cin >> str;
  int res = 0;
  for (int j = 0; j < str.length(); j++) {
    if (isupper(str[j])) {
      if (!cap[str[j] - 'A']) {
        if (low[str[j] - 'A'] && S)
          res++;
        else {
          res = -1;
          break;
        }
      }
    } else {
      if (!low[str[j] - 'a']) {
        res = -1;
        break;
      }
    }
  }
  cout << res << "\n";
  return 0;
}
