#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) {
      res = (res * x) % p;
    }
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long mcd(long long a, long long b) {
  if (b > a) swap(a, b);
  if (b == 0)
    return a;
  else
    return mcd(b, a % b);
}
long long t, n, m, x;
bool esprimo(long long n) {
  long long s = 0;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      s++;
    }
  }
  if (s >= 2) {
    return false;
  }
  return true;
}
int main() {
  cin >> n >> m >> x;
  string a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  bool pos[52];
  memset(pos, false, sizeof pos);
  long long ss = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 'S') {
        ss++;
        for (int k = 0; k < n; k++) {
          for (int l = 0; l < m; l++) {
            if (a[k][l] != 'S') {
              if (x * x >= ((i - k) * (i - k) + (j - l) * (j - l))) {
                pos[int(a[k][l]) - 97 + 26] = true;
              }
            }
          }
        }
      } else {
        pos[int(a[i][j]) - 97] = true;
      }
    }
  }
  string b;
  cin >> n >> b;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (b[i] < 'a') {
      if (ss == 0) {
        cout << -1;
        return 0;
      }
      if (pos[int(b[i]) - 65 + 26] != true && pos[int(b[i]) - 65] == true) {
        ans++;
      } else if (pos[int(b[i]) - 65] == false) {
        cout << -1;
        return 0;
      }
    } else if (pos[int(b[i]) - 97] == false) {
      cout << -1;
      return 0;
    }
  }
  cout << ans;
}
