#include <bits/stdc++.h>
long long P;
__int128 o = 1;
inline long long mul(const long long &a, const long long &b) {
  return o * a * b % P;
}
inline long long sub(long long a, const long long &b) {
  a -= b;
  return (a < 0) ? a + P : a;
}
inline long long add(long long a, const long long &b) {
  a += b;
  return (a >= P) ? a - P : a;
}
long long qsm(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1ll) ans = mul(ans, a);
    a = mul(a, a);
    b >>= 1ll;
  }
  return ans;
}
int R[1000001], lim;
long long t1[1000001], t2[1000001], w[1000001], t3[1000001], t4[1000001];
int a[100001], b[100001], n, m, q;
long long ANS[200010];
void NTT(long long *a) {
  for (int i = 0; i < lim; i++)
    if (i < R[i]) std::swap(a[i], a[R[i]]);
  for (int i = 1; i < lim; i <<= 1)
    for (int j = 0; j < lim; j += (i << 1))
      for (int k = 0; k < i; k++) {
        const long long Ny = mul(a[i + j + k], w[i + k]);
        a[i + j + k] = sub(a[j + k], Ny);
        a[j + k] = add(a[j + k], Ny);
      }
}
void get(bool pre) {
  if (!pre) {
    NTT(t1);
    NTT(t2);
  }
  for (int i = 0; i < lim; i++) t1[i] = mul(t1[i], t2[i]);
  NTT(t1);
  std::reverse(t1 + 1, t1 + lim);
  long long inv = qsm(lim, P - 2);
  for (int i = 0; i < lim; i++) t1[i] = mul(t1[i], inv);
}
void solve(long long P, long long g, long long *Ans) {
  ::P = P;
  for (int i = 1; (i << 1) < (800000); i <<= 1) {
    long long wn = qsm(g, (P - 1) / (i << 1));
    w[i] = 1;
    for (int j = 1; j < i; j++) w[i + j] = mul(w[i + j - 1], wn);
  }
  lim = 1;
  while (lim <= 200000) lim <<= 1;
  for (int i = 0; i < lim; i++)
    R[i] = (R[i >> 1] >> 1) | ((i & 1) ? lim >> 1 : 0);
  memset(t1, 0, sizeof t1);
  memset(t2, 0, sizeof t2);
  for (int i = 1; i <= n; i++) ++t1[a[i]];
  for (int i = 1; i <= m; i++) ++t2[b[i]];
  NTT(t1);
  NTT(t2);
  memcpy(t3, t1, sizeof t1);
  memcpy(t4, t2, sizeof t2);
  get(1);
  for (int i = 1; i <= 200000; i++) t1[i] = add(t1[i], t1[i - 1]);
  for (int i = 1; i <= 200000; i++)
    Ans[i] = sub(sub(t1[200000], t1[i - 1]), t1[i - 1]);
  if (m > 1) {
    memcpy(t1, t3, sizeof t1);
    memset(t2, 0, sizeof t2);
    for (int i = 1; i <= m; i++) t2[b[i]] += (i == 1 || i == m) ? 1 : 2;
    NTT(t2);
    get(1);
    for (int i = 1; i <= 200000; i++) t1[i] = add(t1[i], t1[i - 1]);
    for (int i = 1; i <= 200000; i++)
      Ans[i] = add(Ans[i], mul(sub(t1[i - 1], sub(t1[200000], t1[i - 1])),
                               (P + 1ll) >> 1ll));
  }
  if (n > 1) {
    memset(t1, 0, sizeof t1);
    memcpy(t2, t4, sizeof t2);
    for (int i = 1; i <= n; i++) t1[a[i]] += (i == 1 || i == n) ? 1 : 2;
    NTT(t1);
    get(1);
    for (int i = 1; i <= 200000; i++) t1[i] = add(t1[i], t1[i - 1]);
    for (int i = 1; i <= 200000; i++)
      Ans[i] = add(Ans[i], mul(sub(t1[i - 1], sub(t1[200000], t1[i - 1])),
                               (P + 1ll) >> 1ll));
  }
  memset(t1, 0, sizeof t1);
  memset(t2, 0, sizeof t2);
  for (int i = 1; i < n; i++) ++t1[std::min(a[i], a[i + 1])];
  for (int i = 1; i < m; i++) ++t2[std::min(b[i], b[i + 1])];
  get(0);
  for (int i = 200000; i; i--) t1[i] = add(t1[i], t1[i + 1]);
  for (int i = 1; i <= 200000; i++) Ans[i] = add(Ans[i], t1[i]);
  memset(t1, 0, sizeof t1);
  memset(t2, 0, sizeof t2);
  for (int i = 1; i < n; i++) ++t1[std::max(a[i], a[i + 1])];
  for (int i = 1; i < m; i++) ++t2[std::max(b[i], b[i + 1])];
  get(0);
  for (int i = 1; i <= 200000; i++) t1[i] = add(t1[i], t1[i - 1]);
  for (int i = 1; i <= 200000; i++) Ans[i] = sub(Ans[i], t1[i - 1]);
}
signed main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= m; i++) scanf("%d", b + i);
  solve(75161927681, 3, ANS);
  for (int i = 1, x; i <= q; i++) {
    scanf("%d", &x);
    if (ANS[x] > ((75161927681) >> 1ll))
      printf("%lld\n", ANS[x] - 75161927681ll);
    else
      printf("%lld\n", ANS[x]);
  }
}
