#include <bits/stdc++.h>
const long long int LL_INF = 0x3f3f3f3f3f3f;
using namespace std;
int T;
int n, m, x, q;
string s;
string arr[35];
vector<pair<int, int> > shift;
map<char, double> mp;
bool val = false;
int main() {
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &x);
  for (int i = 0; i < n; ++i) {
    cin >> s;
    for (int j = 0; j < m; ++j) {
      if (s[j] != 'S')
        mp[s[j]] = 1;
      else {
        val = true;
        shift.push_back({i, j});
      }
    }
    arr[i] = s;
  }
  if (val) {
    for (auto &it : shift) {
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
          if (arr[i][j] != 'S') {
            if (!mp[toupper(arr[i][j])])
              mp[toupper(arr[i][j])] = sqrt((it.first - i) * (it.first - i) +
                                            (it.second - j) * (it.second - j));
            else
              mp[toupper(arr[i][j])] =
                  min(mp[toupper(arr[i][j])],
                      sqrt((it.first - i) * (it.first - i) +
                           (it.second - j) * (it.second - j)));
          }
        }
      }
    }
  }
  scanf("%d", &q);
  cin >> s;
  bool can = true;
  int cnt = 0;
  for (int i = 0; i < q; ++i) {
    if (mp[s[i]] > x)
      cnt++;
    else if (mp[s[i]] == 0) {
      can = false;
      break;
    }
  }
  if (can) {
    printf("%d\n", cnt);
  } else
    printf("-1\n");
  return 0;
}
