#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x;
  cin >> n >> m >> x;
  x *= x;
  int arr[26] = {0};
  int brr[26] = {0};
  char keyboard[n][m];
  vector<int> v1;
  vector<int> v2;
  int i, j;
  for (i = 0; i < n; ++i)
    for (j = 0; j < m; ++j) {
      cin >> keyboard[i][j];
      if (keyboard[i][j] == 'S') {
        v1.push_back(i);
        v2.push_back(j);
      } else {
        brr[int(keyboard[i][j]) - 97] = 1;
      }
    }
  int q, k;
  char c;
  cin >> q;
  int count = 0;
  int check;
  for (int h = 0; h < q; ++h) {
    check = 0;
    cin >> c;
    j = c;
    if (j < 91) {
      if (arr[(int)c - 65] == 1)
        count++;
      else if (arr[(int)c - 65] == 2)
        continue;
      else if (v1.size() != 0) {
        j += 32;
        c = (char)j;
        for (i = 0; i < n; ++i) {
          for (j = 0; j < m; ++j) {
            if (keyboard[i][j] == c) {
              check = 1;
              for (k = 0; k < v1.size(); ++k)
                if ((v1[k] - i) * (v1[k] - i) + (v2[k] - j) * (v2[k] - j) <=
                    x) {
                  arr[(int)c - 97] = 2;
                  break;
                }
              if (k < v1.size()) break;
            }
          }
          if (j < m) break;
        }
        if (i >= n) {
          if (check == 1) {
            arr[(int)c - 97] = 1;
            count++;
          } else {
            count = -1;
            break;
          }
        }
      } else {
        count = -1;
        break;
      }
    } else {
      if (brr[(int)c - 97] == 0) {
        count = -1;
        break;
      }
    }
  }
  cout << count;
  return 0;
}
