#include <bits/stdc++.h>
using namespace std;
int dist(pair<int, int>& shift_key, pair<int, int>& normal_key) {
  return (shift_key.first - normal_key.first) *
             (shift_key.first - normal_key.first) +
         (shift_key.second - normal_key.second) *
             (shift_key.second - normal_key.second);
}
int main() {
  int n, m, x;
  cin >> n >> m >> x;
  char keyboard[n][m];
  for (int i = 0; i < n; i++) {
    cin >> keyboard[i];
  }
  vector<pair<int, int> > shift_keys;
  int isShiftKey[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      isShiftKey[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (keyboard[i][j] == 'S') {
        isShiftKey[i][j] = 1;
        shift_keys.push_back(pair<int, int>(i, j));
      }
    }
  }
  int UpperCasePossible[91] = {0};
  int LowerCasePossible[123] = {0};
  int possibleMin[123];
  for (int i = 0; i < 123; i++) {
    possibleMin[i] = 1e9;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!isShiftKey[i][j]) {
        int min_dist = possibleMin[keyboard[i][j] + 0];
        for (int sk = 0; sk < shift_keys.size(); sk++) {
          pair<int, int> normal_key(i, j);
          min_dist = min(min_dist, dist(shift_keys[sk], normal_key));
        }
        possibleMin[keyboard[i][j] + 0] = min_dist;
        if (min_dist != 1e9) {
          if (x * x >= min_dist) {
            UpperCasePossible[keyboard[i][j] - ' '] = 2;
          } else {
            UpperCasePossible[keyboard[i][j] - ' '] = 1;
          }
        }
        LowerCasePossible[keyboard[i][j] + 0] = 1;
      }
    }
  }
  int q;
  cin >> q;
  string T;
  cin >> T;
  int total_move = 0;
  for (int i = 0; i < q; i++) {
    if (T[i] >= 'a' && T[i] <= 'z') {
      if (!LowerCasePossible[T[i] + 0]) {
        cout << -1 << endl;
        return 0;
      }
    } else if (T[i] >= 'A' && T[i] <= 'Z') {
      if (!UpperCasePossible[T[i] + 0]) {
        cout << -1 << endl;
        return 0;
      }
      if (UpperCasePossible[T[i] + 0] == 1) total_move++;
    }
  }
  cout << total_move << endl;
  return 0;
}
