#include <bits/stdc++.h>
using namespace std;
int main() {
  char ch, D[300], test[50][50];
  memset(D, 0, sizeof(D));
  int n, m, x, scount = 0, ans = 0, num;
  cin >> n >> m >> x;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> test[i][j];
      if (test[i][j] != 'S') D[test[i][j]] = 1;
    }
  }
  for (int k = 0; k < n; ++k) {
    for (int i = 0; i < m; ++i) {
      if (test[k][i] == 'S') {
        scount = 1;
        for (int j = 0; j < n; ++j) {
          for (int l = 0; l < m; ++l) {
            if (test[j][l] != 'S') {
              if ((k - j) * (k - j) + (i - l) * (i - l) <= x * x) {
                D[toupper(test[j][l])] = 1;
              }
            }
          }
        }
      }
    }
  }
  cin >> num;
  while (num--) {
    cin >> ch;
    if (D[ch] == 0) {
      if (scount && D[tolower(ch)])
        ans++;
      else {
        ans = -1;
        break;
      }
    }
  }
  cout << ans;
  return 0;
}
