#include <bits/stdc++.h>
using namespace std;
int n, m, x;
char s[31][31];
int lower[26], upper[26];
int main() {
  cin >> n >> m >> x;
  for (int i = 0; i < 26; i++) {
    lower[i] = 0;
    upper[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> s[i][j];
    }
  }
  bool has_shift = false;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i][j] == 'S') {
        has_shift = true;
        for (int k = 0; k < n; k++) {
          for (int l = 0; l < m; l++) {
            if (s[k][l] != 'S' &&
                ((k - i) * (k - i) + (l - j) * (l - j) <= x * x))
              upper[s[k][l] - 'a'] = 1;
          }
        }
      } else {
        lower[s[i][j] - 'a'] = 1;
      }
    }
  }
  int q, i;
  cin >> q;
  char temp[q];
  cin >> temp;
  int ans = 0;
  for (i = 0; i < q; i++) {
    if (temp[i] >= 'a' && temp[i] <= 'z') {
      if (lower[temp[i] - 'a'] == 1) {
      } else
        break;
    } else {
      if (!has_shift) break;
      if (upper[temp[i] - 'A'] == 1) {
      } else if (lower[temp[i] - 'A'] == 1)
        ans++;
      else
        break;
    }
  }
  if (i < q)
    cout << -1;
  else
    cout << ans;
  return 0;
}
