#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a & b);
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
int pow(int a, int b) {
  if (b == 0) return 1;
  int sq = pow(a, b / 2);
  sq = sq * sq;
  if (b % 2) sq *= a;
  return sq;
}
int isprim(int n) {
  bool flag = false;
  for (int i = 2; i <= sqrt(n); ++i) {
    if (n % i == 0) {
      flag = true;
      break;
    }
  }
  return flag;
}
void YN(bool x) {
  if (x)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
bool comp(pair<int, int> a, pair<int, int> b) { return a.first > b.first; }
void solve() {}
int T, n, m, k, x, y, z;
long long int V, P;
int arr[100005], q[100005];
set<pair<int, int> > st;
string str[30], str1;
bool bl, inc;
vector<int> vc;
map<char, int> mp;
pair<int, int> dy[100005], pr[100005];
char cl;
queue<char> que;
int near(int i, int j) {
  int mn = 10000;
  for (set<pair<int, int> >::iterator its = st.begin(); its != st.end();
       its++) {
    pair<int, int> pr = *its;
    int x = (int)ceil(sqrt((pr.first - i) * (pr.first - i) +
                           (pr.second - j) * (pr.second - j)));
    mn = min(mn, x);
  }
  return mn;
}
int main() {
  while (cin >> n >> m >> x) {
    for (int i = 0; i < n; ++i) cin >> str[i];
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j)
        if (str[i][j] == 'S')
          st.insert(make_pair(i, j));
        else
          mp[str[i][j]] = 1000;
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j)
        mp[str[i][j]] = min(mp[str[i][j]], near(i, j));
    cin >> k >> str1;
    m = 0;
    for (int i = 0; i < k; ++i)
      if (str1[i] < 'a') {
        if (st.empty()) {
          cout << "-1\n";
          return 0;
        }
        n = str1[i] - 'A' + 'a';
        if (mp[n]) {
          if (mp[n] > x) m++;
        } else {
          cout << "-1\n";
          return 0;
        }
      } else if (!mp[str1[i]]) {
        cout << "-1\n";
        return 0;
      }
    cout << m << endl;
  }
}
