#include <bits/stdc++.h>
using namespace std;
int n, m, x, y[26], z[26], q, S, ans;
string s[35], t;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  cin >> n >> m >> x;
  x *= x;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  cin >> q >> t;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i][j] == 'S') {
        S++;
        continue;
      } else
        y[s[i][j] - 'a']++;
      for (int ii = 0; ii < n; ii++) {
        for (int jj = 0; jj < m; jj++) {
          if (s[ii][jj] == 'S') {
            if ((ii - i) * (ii - i) + (jj - j) * (jj - j) <= x) {
              z[s[i][j] - 'a'] = 1;
            }
          }
        }
      }
    }
  }
  for (int i = 0; i < q; i++) {
    int flag = 0;
    if (t[i] <= 'Z') {
      t[i] += 0x20;
      flag = 1;
    }
    if (y[t[i] - 'a'] == 0 || (flag && S == 0)) {
      ans = -1;
      break;
    }
    if (z[t[i] - 'a'] == 0 && flag) ans++;
  }
  cout << ans;
}
