#include <bits/stdc++.h>
using namespace std;
char a[101][101], c[101], y;
int i, j, n, m, x, s[2001][2], d, res, k, l, flag, t, al[101];
double r[2001][101];
double ququ(int a, int b) { return sqrt(1.0 * (a * a + b * b)); }
int main() {
  for (i = 0, y = 'a'; i < 26; y++, ++i) c[i] = y;
  cin >> n >> m >> x;
  for (i = 0; i < n; ++i)
    for (j = 0; j < m; ++j) {
      cin >> a[i][j];
      if (a[i][j] == 'S') {
        s[d][0] = i;
        s[d][1] = j;
        d++;
      }
      al[a[i][j] - 97] = 1;
    }
  for (i = 0; i < d; ++i)
    for (j = 0; j < 26; ++j) {
      r[i][j] = 1e9;
      for (k = 0; k < n; ++k)
        for (l = 0; l < m; ++l)
          if (a[k][l] == c[j])
            r[i][j] = (((r[i][j]) < (ququ(k - s[i][0], l - s[i][1])))
                           ? (r[i][j])
                           : (ququ(k - s[i][0], l - s[i][1])));
    }
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> y;
    if (isupper(y)) {
      j = y - 65;
      t = flag = 0;
      for (k = 0; k < d; ++k) {
        if (r[k][j] < 1e9) t = 1;
        if (r[k][j] < x || fabs(r[k][j] - x) < 1e-3) {
          flag = 1;
          break;
        }
      }
      if (!flag) res++;
      if (!t) {
        cout << -1;
        return 0;
      }
    } else if (!al[y - 97]) {
      cout << -1;
      return 0;
    }
  }
  cout << res;
  return 0;
}
