#include <bits/stdc++.h>
using namespace std;
using ll = long long;
double squareRoot(double n) { return pow(2, 0.5 * log2(n)); }
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool pal(string& s) {
  for (int i = 0; i < s.size() / 2; i++) {
    if (s[i] != s[s.size() - i - 1]) return 0;
  }
  return 1;
}
ll MOD = 1000000007;
ll powmod(ll a, ll b, ll m) {
  if (b == 0) return 1;
  if (b == 1) return a;
  ll p1 = powmod(a, b / 2ll, m);
  ll p2 = p1 * p1;
  ll p3 = powmod(a, b % 2ll, m);
  return ((p2 % m) * (p3 % m)) % m;
}
ll modpow(ll a, ll b, ll x) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % x;
    a = (a * a) % x;
    b >>= 1;
  }
  return res;
}
ll ncr(ll n, ll r) {
  if (n == 0 || r == 0) return 1;
  if (r > n) return 0;
  if (n - r < r) r = n - r;
  ll ans = 1;
  for (ll i = 1; i <= r; i++) {
    ans = ans * (n - i + 1) / i;
  }
  return ans;
}
bool bruteprime(ll n) {
  if (n == 1) return 0;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
vector<ll> primefactors(ll n) {
  vector<ll> ans;
  while (n % 2 == 0) {
    ans.push_back(2);
    n /= 2;
  }
  for (int i = 3; i * i <= n; i += 2) {
    while (n % i == 0) {
      ans.push_back(i);
      n /= i;
    }
  }
  if (n > 2) ans.push_back(n);
  return ans;
}
vector<ll> factors(ll n) {
  vector<ll> ans;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      ans.push_back(i);
      if (n / i != i) {
        ans.push_back(n / i);
      }
    }
  }
  return ans;
}
void computeLPSArray(string pat, int M, int* lps);
int KMPSearch(string pat, string txt) {
  int M = pat.size();
  int N = txt.size();
  int lps[M];
  computeLPSArray(pat, M, lps);
  int i = 0;
  int j = 0;
  int ans = 0;
  while (i < N) {
    if (pat[j] == txt[i]) {
      j++;
      i++;
    }
    if (j == M) {
      ans++;
      j = lps[j - 1];
    } else if (i < N && pat[j] != txt[i]) {
      if (j != 0)
        j = lps[j - 1];
      else
        i = i + 1;
    }
  }
  return ans;
}
void computeLPSArray(string pat, int M, int* lps) {
  int len = 0;
  lps[0] = 0;
  int i = 1;
  while (i < M) {
    if (pat[i] == pat[len]) {
      len++;
      lps[i] = len;
      i++;
    } else {
      if (len != 0) {
        len = lps[len - 1];
      } else {
        lps[i] = 0;
        i++;
      }
    }
  }
}
ll nCrModp(ll n, ll r, ll p) {
  if (r > n - r) r = n - r;
  ll C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (ll i = 1; i <= n; i++) {
    for (ll j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
bool cmp(pair<ll, ll>& a, pair<ll, ll>& b) {
  return (a.first - a.second > b.first - b.second);
}
void solve() {
  ll n, m, x;
  cin >> n >> m >> x;
  string s[n];
  for (ll i = 0; i < (n); ++i) cin >> s[i];
  map<char, bool> m1, m2;
  bool f = 0;
  for (ll i = 0; i < (n); ++i) {
    for (ll j = 0; j < (m); ++j) {
      if (s[i][j] >= 'a' && s[i][j] <= 'z') {
        m1[s[i][j]] = 1;
      } else {
        f = 1;
        for (ll k = 0; k < (n); ++k) {
          for (ll l = 0; l < (m); ++l) {
            double dist = sqrt(pow((i - k), 2.0) + pow(j - l, 2.0));
            if (dist <= (double)x) {
              m2[s[k][l]] = 1;
            }
          }
        }
      }
    }
  }
  cin >> n;
  string sa;
  cin >> sa;
  ll c = 0;
  for (ll i = 0; i < (n); ++i) {
    if (sa[i] >= 'a' && sa[i] <= 'z') {
      if (m1[sa[i]] == 0) {
        cout << "-1";
        return;
      }
    } else {
      if (f == 0 || m1[sa[i] - 'A' + 'a'] == 0) {
        cout << "-1";
        return;
      } else {
        if (m2[sa[i] - 'A' + 'a'] == 0) {
          c++;
        }
      }
    }
  }
  cout << c;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  ll t = 1;
  while (t--) solve();
  return 0;
}
