#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
const int INF = 1 << 29;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int& n, int b) { n |= two(b); }
inline void unset_bit(int& n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) {
  int res = 0;
  while (n && ++res) n -= n & (-n);
  return res;
}
template <class T>
void chmax(T& a, const T& b) {
  a = max(a, b);
}
template <class T>
void chmin(T& a, const T& b) {
  a = min(a, b);
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
int mulmd(long long a, long long b) {
  long long ret = (a * b) % 1000000007;
  return (int)ret;
}
inline int power(long long x, long long y, int p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = mulmd(res, x);
    y = y >> 1;
    x = mulmd(x, x);
  }
  return (int)res;
}
int submd(long long a, long long b) {
  long long ret = a - b;
  if (ret < 0) {
    ret += 1000000007;
  }
  return (int)ret;
}
int addmd(long long a, long long b) {
  long long ret = (a + b) % 1000000007;
  return (int)ret;
}
int phi(int n) {
  int result = n;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) {
        n = n / i;
      }
      result -= result / i;
    }
  }
  if (n > 1) result -= result / n;
  return result;
}
int gcd(int a, int b, int& x, int& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  int x1, y1;
  int d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
int arr[100005];
int dist(int x1, int y1, int x2, int y2) {
  int dx = x2 - x1;
  int dy = y2 - y1;
  float ans = sqrt(dx * dx + dy * dy);
  return ceil(ans);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, x;
  cin >> n >> m >> x;
  char par[n][m];
  vector<pair<int, int> > shift;
  map<char, int> thug;
  for (int i = 0; i < (n); i++) {
    for (int j = 0; j < (m); j++) {
      cin >> par[i][j];
      if (par[i][j] == 'S') shift.push_back({i, j});
      if (par[i][j] != 'S') thug[par[i][j]]++;
    }
  }
  int answer = 0;
  map<char, int> mp;
  for (char ch = 'a'; ch <= 'z'; ch++) {
    int flag = 0;
    for (int i = 0; i < (n); i++) {
      for (int j = 0; j < (m); j++) {
        if (par[i][j] == ch) {
          for (int h = 0; h < shift.size(); h++) {
            int distance = dist(i, j, shift[h].first, shift[h].second);
            if (distance <= x) {
              flag = 1;
              break;
            }
          }
        }
      }
    }
    if (flag == 0 && shift.size() > 0)
      mp[ch] = 1;
    else if (flag == 1)
      mp[ch] = 2;
  }
  int q;
  cin >> q;
  string g;
  cin >> g;
  int f = 0;
  for (int i = 0; i < (q); i++) {
    if (isupper(g[i])) {
      char x = tolower(g[i]);
      if (thug[x] && shift.size() > 0) {
        if (mp[x] == 1) answer++;
      } else {
        f = 1;
        break;
      }
    } else {
      if (!thug[g[i]]) {
        f = 1;
        break;
      }
    }
  }
  if (f == 0)
    cout << answer;
  else
    cout << -1;
}
