#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, l, x, a, b, aa, bb, ccc, dd, arr[130], brr[130];
char c[32][32], cc[500009];
int dis(int aa, int bb, int ccc, int dd) {
  return ((aa - bb) * (aa - bb) + (ccc - dd) * (ccc - dd));
}
int main() {
  scanf("%d %d %d", &n, &m, &x);
  for (i = 0; i < n; i++) scanf("%s", &c[i]);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (c[i][j] == 'S') {
        l = 1;
        for (a = 0; a < n; a++) {
          for (b = 0; b < m; b++) {
            if (c[a][b] != 'S' && dis(a, i, b, j) <= x * x) {
              arr[c[a][b] - 'a'] = 1;
            }
          }
        }
      } else
        brr[c[i][j] - 'a'] = 1;
    }
  }
  m = 0;
  aa = 0;
  scanf("%d %s", &n, &cc);
  for (i = 0; i < n && m == 0; i++) {
    if ((cc[i] >= 'A' && cc[i] <= 'Z' && (brr[cc[i] - 'A'] == 0 || l == 0)) ||
        (cc[i] >= 'a' && brr[cc[i] - 'a'] == 0))
      m = 1;
    else if (cc[i] >= 'A' && cc[i] <= 'Z' && arr[cc[i] - 'A'] == 0)
      aa++;
  }
  if (m)
    printf("-1");
  else
    printf("%d", aa);
}
