#include <bits/stdc++.h>
using namespace std;
int N, M, X;
char b[33][33];
int cnt[127];
char type[1234567];
int main() {
  while (cin >> N >> M >> X) {
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < N; i++) {
      cin >> b[i];
    }
    bool sf = false;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < M; j++) {
        if (b[i][j] >= 'a') {
          cnt[b[i][j]] = 1;
          for (int p = 0; p < N; p++)
            for (int q = 0; q < M; q++)
              if (b[p][q] == 'S' &&
                  (i - p) * (i - p) + (j - q) * (j - q) <= X * X)
                cnt[b[i][j] + 'A' - 'a'] = 1;
        } else if (b[i][j] == 'S')
          sf = true;
      }
    }
    int ans = 0;
    int tmp;
    cin >> tmp;
    cin >> type;
    for (int i = 0; ans >= 0 && i < tmp; i++) {
      if (type[i] >= 'a' && cnt[type[i]] == 0) ans = -1;
      if (cnt[type[i]] == 1)
        continue;
      else if (cnt[type[i] + 'a' - 'A'] && sf) {
        ans++;
      } else
        ans = -1;
    }
    if (ans >= 0)
      cout << ans << endl;
    else
      cout << "-1" << endl;
  }
  return 0;
}
