#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) { return a > b ? a : b; }
long long getsum(string n) {
  long long ans = 0;
  for (long long i = 0; i < n.length(); i++) {
    ans += n[i] - '0';
  }
  return ans;
}
long long power(long long x, long long y, long long mod) {
  long long res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
string CONVERT_TO_BINARY(long long s) {
  string res = "";
  while (s != 0) {
    res += (char)('0' + s % 2);
    s /= 2;
  }
  reverse(res.begin(), res.end());
  return res;
}
bool PALIN(string s) {
  long long i = 0;
  long long j = s.length() - 1;
  while (i <= j) {
    if (s[i] != s[j]) return false;
    j--, i++;
  }
  return true;
}
long long modInverse(long long a, long long m) { return power(a, m - 2); }
long long findLongestSub(string bin) {
  long long n = bin.length(), i;
  long long sum = 0;
  unordered_map<long long, long long> prevSum;
  long long maxlen = 0;
  long long currlen;
  for (i = 0; i < n; i++) {
    if (bin[i] == '1')
      sum++;
    else
      sum--;
    if (sum > 0) {
      maxlen = i + 1;
    } else if (sum <= 0) {
      if (prevSum.find(sum - 1) != prevSum.end()) {
        currlen = i - prevSum[sum - 1];
        maxlen = max(maxlen, currlen);
      }
    }
    if (prevSum.find(sum) == prevSum.end()) prevSum[sum] = i;
  }
  return maxlen;
}
long long binaryToDecimal(string n) {
  string num = n;
  long long dec_value = 0;
  long long base = 1;
  long long len = num.length();
  for (long long i = len - 1; i >= 0; i--) {
    if (num[i] == '1') dec_value += base;
    base = base * 2;
  }
  return dec_value;
}
long long _gcd(long long a, long long b) {
  if (b > a) return _gcd(b, a);
  if (b == 0)
    return a;
  else
    return _gcd(b, a % b);
}
long long digitsum(long long num) {
  long long ans = 0;
  while (num > 0) {
    ans += num % 10;
    num /= 10;
  }
  return ans;
}
long long countbits(long long n) {
  long long cnt = 0;
  while (n > 0) {
    cnt++;
    n /= 2;
  }
  return cnt;
}
long long countSetBits(long long n) {
  long long count = 0;
  while (n) {
    count += n & 1;
    n >>= 1;
  }
  return count;
}
void _ios() {
  ios_base::sync_with_stdio(false);
  ;
  cin.tie(0);
  cout.tie(0);
}
void _rw() {}
unordered_map<char, vector<pair<long long, long long> > > m;
bool check(pair<long long, long long> x, pair<long long, long long> y,
           long long l) {
  long long diffx = x.first - y.first;
  long long diffy = y.second - x.second;
  double ans = sqrt((double)diffx * diffx + (double)diffy * diffy);
  if (ans <= (double)l) return 0;
  return 1;
}
unordered_map<char, long long> cansolve;
void solve() {
  long long n, mm;
  cin >> n >> mm;
  long long l;
  cin >> l;
  char a[n][mm];
  for (long long i = 0; i <= n - 1; i++) {
    for (long long j = 0; j <= mm - 1; j++) {
      cin >> a[i][j];
      if (a[i][j] == 'S') {
        m['S'].push_back({i + 1, j + 1});
      }
      if (a[i][j] >= 'a' && a[i][j] <= 'z')
        m[a[i][j]].push_back({i + 1, j + 1});
    }
  }
  long long ans = 0;
  long long q;
  cin >> q;
  string s;
  cin >> s;
  for (int i = 0; i < 26; i++) {
    cansolve['a' + i] = -1;
    cansolve['A' + i] = -1;
  }
  for (long long i = 0; i <= s.length() - 1; i++) {
    if (cansolve[s[i]] != -1) {
      ans += cansolve[s[i]];
      continue;
    }
    if (s[i] >= 'A' && s[i] <= 'Z') {
      vector<pair<long long, long long> > x = m[tolower(s[i])];
      vector<pair<long long, long long> > y = m['S'];
      if (x.size() == 0 || y.size() == 0) {
        cout << -1 << '\n';
        return;
      }
      bool can = 1;
      for (long long j = 0; j <= x.size() - 1; j++) {
        for (long long k = 0; k <= y.size() - 1; k++) {
          can &= check(x[j], y[k], l);
        }
      }
      if (can) {
        cansolve[s[i]] = 1;
        ans++;
      } else {
        cansolve[s[i]] = 0;
      }
    } else if (m[s[i]].size() == 0) {
      cout << -1 << '\n';
      return;
    }
  }
  cout << ans << '\n';
}
int main() {
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
}
