#include <bits/stdc++.h>
using namespace std;
char B[30][40];
int V[256];
int main(int argc, char* argv[]) {
  int i, j, i1, j1, n, m, s, q, r;
  unsigned char c;
  cin >> n >> m >> s;
  for (i = 0; i < n; i++) cin >> B[i];
  for (c = 1; c != 0; c++)
    if (c <= 'Z' && c >= 'A') {
      V[c] = -1;
      char d = c + 'a' - 'A';
      for (i = 0; i < n; i++)
        for (j = 0; j < m; j++)
          if (B[i][j] == d) {
            for (i1 = 0; i1 < n; i1++)
              for (j1 = 0; j1 < m; j1++)
                if (B[i1][j1] == 'S')
                  if ((i1 - i) * (i1 - i) + (j1 - j) * (j1 - j) <= s * s)
                    V[c] = 0;
                  else if (V[c] == -1)
                    V[c] = 1;
          }
    } else if (c <= 'z' && c >= 'a') {
      V[c] = -1;
      for (i = 0; i < n; i++)
        for (j = 0; j < m; j++)
          if (B[i][j] == c) V[c] = 0;
    }
  cin >> q;
  r = 0;
  for (i = 0; i < q; i++) {
    cin >> c;
    if (V[c] == -1) {
      cout << -1;
      return 0;
    } else
      r += V[c];
  }
  cout << r;
  return 0;
}
