#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x;
  cin >> n >> m >> x;
  set<char> s;
  char c[30][30];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> c[i][j];
  bool a[26] = {false};
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (c[i][j] == 'S') continue;
      s.insert(c[i][j]);
      for (int ii = 0; ii < n; ii++)
        for (int jj = 0; jj < m; jj++)
          if (c[ii][jj] == 'S') {
            s.insert(c[i][j] - 'a' + 'A');
            if ((ii - i) * (ii - i) + (jj - j) * (jj - j) <= x * x)
              a[c[i][j] - 'a'] = true;
          }
    }
  int ans = 0, q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    char ch;
    cin >> ch;
    if (s.find(ch) == s.end()) {
      cout << -1;
      return 0;
    }
    if (ch >= 'A' && ch <= 'Z' && !a[ch - 'A']) ans++;
  }
  cout << ans;
  return 0;
}
