#include <bits/stdc++.h>
using namespace std;
int n, m, d;
string kbd[30];
bool was[256];
bool can[256];
int main() {
  cin >> n >> m >> d;
  for (int i = 0; i < n; i++) {
    cin >> kbd[i];
    for (int j = 0; j < m; j++) {
      was[kbd[i][j]] = true;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (kbd[i][j] != 'S') {
        can[kbd[i][j]] = true;
      }
      if ('a' <= kbd[i][j] && kbd[i][j] <= 'z') {
        for (int ii = 0; ii < n; ii++) {
          if (can[kbd[i][j] - 'a' + 'A']) break;
          for (int jj = 0; jj < m; jj++) {
            int dx = abs(j - jj);
            int dy = abs(i - ii);
            if (dx * dx + dy * dy <= d * d && kbd[ii][jj] == 'S') {
              can[kbd[i][j] - 'a' + 'A'] = true;
              break;
            }
          }
        }
      }
    }
  }
  int len;
  cin >> len;
  string s;
  cin >> s;
  int tot = 0;
  for (int i = 0; i < s.size(); i++) {
    if (can[s[i]]) {
      continue;
    }
    if ('A' <= s[i] && s[i] <= 'Z') {
      if (was[s[i] - 'A' + 'a'] && was['S']) {
        tot++;
        continue;
      }
    }
    cout << -1 << endl;
    return 0;
  }
  cout << tot << endl;
  return 0;
}
