#include <bits/stdc++.h>
using namespace std;
string s[30];
bool a[26], b[26];
int main() {
  int n, m, x;
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++) cin >> s[i];
  bool t = false;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i][j] == 'S') {
        t = true;
        for (int k = 0; k < n; k++) {
          for (int l = 0; l < m; l++) {
            if (s[k][l] != 'S' &&
                (i - k) * (i - k) + (j - l) * (j - l) <= x * x)
              b[s[k][l] - 'a'] = true;
          }
        }
      } else
        a[s[i][j] - 'a'] = true;
    }
  }
  int o;
  string s;
  cin >> o >> s;
  int i, ans = 0;
  for (i = 0; i < o; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      if (!t) break;
      if (b[s[i] - 'A'])
        continue;
      else if (a[s[i] - 'A'])
        ans++;
      else
        break;
    } else {
      if (a[s[i] - 'a'])
        continue;
      else
        break;
    }
  }
  if (i == o)
    cout << ans;
  else
    cout << "-1";
  return 0;
}
