#include <bits/stdc++.h>
using namespace std;
int board[1000];
int main() {
  int i, j, n, m, q;
  double x;
  cin >> n >> m >> x;
  char a[50][50];
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
      board[a[i][j]] = 1;
    }
  }
  bool flag = false;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (a[i][j] == 'S') {
        flag = true;
        for (int k = i - x; k <= i + x; k++) {
          if (k < 0 || k >= n) continue;
          for (int l = j - x; l <= j + x; l++) {
            if (l < 0 || l >= m) continue;
            if (double(sqrt(((i - k) * (i - k)) + ((j - l) * (j - l)))) <= x) {
              board[a[k][l]] = 2;
            }
          }
        }
      }
    }
  }
  string s;
  cin >> q >> s;
  int countt = 0;
  for (i = 0; i < q; i++) {
    if (s[i] >= 65 && s[i] < 97) {
      if (!flag) {
        cout << "-1" << endl;
        return 0;
      }
      if (board[s[i] + 32] == 0) {
        cout << "-1" << endl;
        return 0;
      }
      if (board[s[i] + 32] == 1) countt++;
    } else {
      if (board[s[i]] == 0) {
        cout << "-1" << endl;
        return 0;
      }
    }
  }
  cout << countt << endl;
}
