#include <bits/stdc++.h>
using namespace std;
int OO = 2e9;
const double eps = 1e-9;
int mx = -2e9, mn = 2e9;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int ans = 0, x = 1, vis[26] = {0};
  vector<pair<int, int> > chrs[26];
  vector<pair<int, int> > s;
  char arr[n][m];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      pair<int, int> temp = make_pair(i, j);
      cin >> arr[i][j];
      if (arr[i][j] == 'S') {
        s.push_back(temp);
      } else {
        chrs[arr[i][j] - 97].push_back(temp);
      }
    }
  }
  int q;
  cin >> q;
  string l;
  cin >> l;
  for (int i = 0; i < l.size(); ++i) {
    if (l[i] >= 'a' && !chrs[l[i] - 97].size()) {
      x = 0;
      break;
    } else if (l[i] < 'a') {
      if (vis[l[i] - 65] == 1)
        continue;
      else if (vis[l[i] - 65] == -1) {
        ++ans;
        continue;
      }
      if (!chrs[l[i] - 65].size()) {
        x = 0;
        break;
      } else {
        if (!s.size()) {
          x = 0;
          break;
        } else {
          int y = 0;
          for (int j = 0; j < s.size(); ++j) {
            for (int o = 0; o < chrs[l[i] - 65].size(); ++o) {
              if (sqrt(pow(abs(chrs[l[i] - 65][o].first - s[j].first), 2) +
                       pow(abs(chrs[l[i] - 65][o].second - s[j].second), 2)) <=
                  k) {
                y = 1;
                j = s.size();
                o = chrs[l[i] - 65].size();
              }
            }
          }
          if (!y) {
            ++ans;
            vis[l[i] - 65] = -1;
          } else
            vis[l[i] - 65] = 1;
        }
      }
    }
  }
  cout << (x ? ans : -1) << endl;
  return 0;
}
