#include <bits/stdc++.h>
using namespace std;
const int MOD(1000000007);
const int INF((1 << 30) - 1);
const int MAXN(30);
string a[MAXN];
int type[200] = {0};
int main() {
  int n, m, x;
  scanf("%d%d%d", &n, &m, &x);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 'A'; i <= 'Z'; i++) type[i] = INF;
  for (int i = 'a'; i <= 'z'; i++) type[i] = INF;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (a[i][j] != 'S')
        type[a[i][j]] = 1;
      else {
        for (int k = 0; k < n; k++)
          for (int l = 0; l < m; l++)
            if (a[k][l] != 'S')
              type[a[k][l] - 'a' + 'A'] =
                  min(type[a[k][l] - 'a' + 'A'],
                      (i - k) * (i - k) + (j - l) * (j - l));
      }
    }
  int q;
  scanf("%d", &q);
  int ans = 0;
  while (q--) {
    char c;
    scanf(" %c", &c);
    if (type[c] == INF) {
      printf("-1");
      return 0;
    } else if (c >= 'A' && c <= 'Z' && type[c] > x * x)
      ans++;
  }
  printf("%d", ans);
}
