#include <bits/stdc++.h>
using namespace std;
int m, n, x;
char a[33][33];
bool can[333];
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  while (cin >> m >> n >> x) {
    memset(can, false, sizeof can);
    bool hasShift = false;
    for (int i = (1), _b = (m); i <= _b; i++)
      for (int j = (1), _b = (n); j <= _b; j++) cin >> a[i][j];
    for (int i = (1), _b = (m); i <= _b; i++)
      for (int j = (1), _b = (n); j <= _b; j++) {
        if (a[i][j] == 'S') {
          hasShift = true;
          for (int u = (1), _b = (m); u <= _b; u++)
            for (int v = (1), _b = (n); v <= _b; v++)
              if (a[u][v] != 'S' &&
                  ((i - u) * (i - u)) + ((j - v) * (j - v)) <= x * x) {
                can[a[u][v] ^ ' '] = true;
              }
        } else {
          can[a[i][j]] = true;
        }
      }
    int q;
    cin >> q;
    string s;
    cin >> s;
    bool good = true;
    int cnt = 0;
    for (char c : s) {
      if (c >= 'a' && c <= 'z') {
        if (!can[c]) {
          good = false;
          break;
        }
      } else {
        if (!hasShift) {
          good = false;
          break;
        }
        if (!can[c]) {
          if (can[c ^ ' '])
            ++cnt;
          else
            good = false;
        }
      }
    }
    if (good)
      cout << cnt << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
