#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 19;
const long long MOD = 1e9 + 7;
const double EPS = 1e-9;
void solve() {
  int n, m, x, q, c = 0;
  cin >> n >> m >> x;
  vector<pair<int, int>> v;
  char arr[n][m];
  bool flag = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      char ch;
      cin >> ch;
      if (ch == 'S') {
        flag = 1;
        v.emplace_back(i, j);
        arr[i][j] = '$';
        continue;
      }
      arr[i][j] = ch;
    }
  }
  map<char, int> mp;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      mp[arr[i][j]] = 1;
      if (flag && !mp[arr[i][j] - 32]) mp[arr[i][j] - 32] = 2;
      for (auto it : v) {
        if (sqrt(pow(it.first - i, 2) + pow(it.second - j, 2)) <= x) {
          mp[arr[i][j] - 32] = 1;
        }
      }
    }
  }
  cin >> q;
  string s;
  cin >> s;
  bool valid = 1;
  for (auto i : s) {
    if (mp[i]) {
      if (mp[i] == 2) {
        c++;
      }
    } else
      valid = 0;
  }
  cout << (valid ? c : -1) << '\n';
}
int main() {
  ios::sync_with_stdio(0), cin.tie(nullptr), cout.tie(nullptr);
  int t = 1;
  while (t--) solve();
}
