#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 7;
int n, m, k, q, lim, a[N], b[N], f1[N], f2[N], rev[N];
long long f3[N], f4[N], f5[N];
inline int read() {
  int num = 0;
  char g = getchar();
  while (g < 48 || 57 < g) g = getchar();
  while (47 < g && g < 58)
    num = (num << 1) + (num << 3) + g - 48, g = getchar();
  return num;
}
namespace sub1 {
const int p = 998244353;
inline long long pows(long long u, int v) {
  long long ans = 1;
  while (v > 0) {
    if (v & 1) ans = ans * u % p;
    u = u * u % p, v = v >> 1;
  }
  return ans;
}
inline int inc(int a, int b) {
  if (a + b >= p) return a + b - p;
  return a + b;
}
inline int sub(int a, int b) {
  if (a - b < 0) return a - b + p;
  return a - b;
}
inline void ntt(int *s) {
  for (int i = 0; i < lim; i++)
    if (i < rev[i]) swap(s[i], s[rev[i]]);
  for (int d = 1; d < lim; d = d << 1) {
    long long w = pows(3, (p - 1) / (d << 1));
    for (int i = 0, r = d << 1; i < lim; i += r) {
      long long wn = 1;
      for (int j = 0; j < d; j++, wn = wn * w % p) {
        int a = s[i + j], b = s[i + j + d] * wn % p;
        s[i + j] = inc(a, b), s[i + j + d] = sub(a, b);
      }
    }
  }
}
inline void intt(int *s) {
  for (int i = 0; i < lim; i++)
    if (i < rev[i]) swap(s[i], s[rev[i]]);
  for (int d = 1; d < lim; d = d << 1) {
    long long w = pows(332748118, (p - 1) / (d << 1));
    for (int i = 0, r = d << 1; i < lim; i += r) {
      long long wn = 1;
      for (int j = 0; j < d; j++, wn = wn * w % p) {
        int a = s[i + j], b = s[i + j + d] * wn % p;
        s[i + j] = inc(a, b), s[i + j + d] = sub(a, b);
      }
    }
  }
  long long inv = pows(lim, p - 2);
  for (int i = 0; i < lim; i++) s[i] = s[i] * inv % p;
}
}  // namespace sub1
namespace sub2 {
const int p = 167772161;
inline long long pows(long long u, int v) {
  long long ans = 1;
  while (v > 0) {
    if (v & 1) ans = ans * u % p;
    u = u * u % p, v = v >> 1;
  }
  return ans;
}
inline int inc(int a, int b) {
  if (a + b >= p) return a + b - p;
  return a + b;
}
inline int sub(int a, int b) {
  if (a - b < 0) return a - b + p;
  return a - b;
}
inline void ntt(int *s) {
  for (int i = 0; i < lim; i++)
    if (i < rev[i]) swap(s[i], s[rev[i]]);
  for (int d = 1; d < lim; d = d << 1) {
    long long w = pows(3, (p - 1) / (d << 1));
    for (int i = 0, r = d << 1; i < lim; i += r) {
      long long wn = 1;
      for (int j = 0; j < d; j++, wn = wn * w % p) {
        int a = s[i + j], b = s[i + j + d] * wn % p;
        s[i + j] = inc(a, b), s[i + j + d] = sub(a, b);
      }
    }
  }
}
inline void intt(int *s) {
  for (int i = 0; i < lim; i++)
    if (i < rev[i]) swap(s[i], s[rev[i]]);
  for (int d = 1; d < lim; d = d << 1) {
    long long w = pows(55924054, (p - 1) / (d << 1));
    for (int i = 0, r = d << 1; i < lim; i += r) {
      long long wn = 1;
      for (int j = 0; j < d; j++, wn = wn * w % p) {
        int a = s[i + j], b = s[i + j + d] * wn % p;
        s[i + j] = inc(a, b), s[i + j + d] = sub(a, b);
      }
    }
  }
  long long inv = pows(lim, p - 2);
  for (int i = 0; i < lim; i++) s[i] = s[i] * inv % p;
}
}  // namespace sub2
int main() {
  cin >> n >> m >> q, lim = 1, k = 0;
  while (lim < 2e5) lim = lim << 1, k++;
  for (int i = 0; i < lim; i++)
    rev[i] = (rev[i >> 1] >> 1) | (i & 1) << (k - 1);
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= m; i++) b[i] = read();
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i <= n; i++) f1[a[i]]++;
  for (int i = 1; i <= m; i++) f2[b[i]]++;
  sub1::ntt(f1), sub1::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 998244353;
  sub1::intt(f1);
  for (int i = 2e5; i >= 1; i--) f3[i] = sub1::inc(f1[i], f3[i + 1]);
  for (int i = 1; i <= 2e5; i++)
    f4[i] = sub1::sub(f3[i] * 2 % 998244353, 1ll * n * m % 998244353);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i < n; i++) f1[min(a[i], a[i + 1])]++;
  for (int i = 1; i <= m; i++) f2[b[i]]++;
  sub1::ntt(f1), sub1::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 998244353;
  sub1::intt(f1);
  for (int i = 2e5; i >= 1; i--) f3[i] = sub1::inc(f1[i], f3[i + 1]);
  for (int i = 1; i <= 2e5; i++) f4[i] = sub1::sub(f4[i], f3[i]);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i <= n; i++) f1[a[i]]++;
  for (int i = 1; i < m; i++) f2[min(b[i], b[i + 1])]++;
  sub1::ntt(f1), sub1::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 998244353;
  sub1::intt(f1);
  for (int i = 2e5; i >= 1; i--) f3[i] = sub1::inc(f1[i], f3[i + 1]);
  for (int i = 1; i <= 2e5; i++) f4[i] = sub1::sub(f4[i], f3[i]);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i < n; i++) f1[max(a[i], a[i + 1])]++;
  for (int i = 1; i <= m; i++) f2[b[i]]++;
  sub1::ntt(f1), sub1::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 998244353;
  sub1::intt(f1);
  for (int i = 1; i <= 2e5; i++) f3[i] = sub1::inc(f1[i], f3[i - 1]);
  for (int i = 1; i <= 2e5; i++) f4[i] = sub1::inc(f4[i], f3[i - 1]);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i <= n; i++) f1[a[i]]++;
  for (int i = 1; i < m; i++) f2[max(b[i], b[i + 1])]++;
  sub1::ntt(f1), sub1::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 998244353;
  sub1::intt(f1);
  for (int i = 1; i <= 2e5; i++) f3[i] = sub1::inc(f1[i], f3[i - 1]);
  for (int i = 1; i <= 2e5; i++) f4[i] = sub1::inc(f4[i], f3[i - 1]);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i < n; i++) f1[min(a[i], a[i + 1])]++;
  for (int i = 1; i < m; i++) f2[min(b[i], b[i + 1])]++;
  sub1::ntt(f1), sub1::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 998244353;
  sub1::intt(f1);
  for (int i = 2e5; i >= 1; i--) f3[i] = sub1::inc(f1[i], f3[i + 1]);
  for (int i = 1; i <= 2e5; i++) f4[i] = sub1::inc(f4[i], f3[i]);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i < n; i++) f1[max(a[i], a[i + 1])]++;
  for (int i = 1; i < m; i++) f2[max(b[i], b[i + 1])]++;
  sub1::ntt(f1), sub1::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 998244353;
  sub1::intt(f1);
  for (int i = 1; i <= 2e5; i++) f3[i] = sub1::inc(f1[i], f3[i - 1]);
  for (int i = 1; i <= 2e5; i++) f4[i] = sub1::sub(f4[i], f3[i - 1]);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i <= n; i++) f1[a[i]]++;
  for (int i = 1; i <= m; i++) f2[b[i]]++;
  sub2::ntt(f1), sub2::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 167772161;
  sub2::intt(f1);
  for (int i = 2e5; i >= 1; i--) f3[i] = sub2::inc(f1[i], f3[i + 1]);
  for (int i = 1; i <= 2e5; i++)
    f5[i] = sub2::sub(f3[i] * 2 % 167772161, 1ll * n * m % 167772161);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i < n; i++) f1[min(a[i], a[i + 1])]++;
  for (int i = 1; i <= m; i++) f2[b[i]]++;
  sub2::ntt(f1), sub2::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 167772161;
  sub2::intt(f1);
  for (int i = 2e5; i >= 1; i--) f3[i] = sub2::inc(f1[i], f3[i + 1]);
  for (int i = 1; i <= 2e5; i++) f5[i] = sub2::sub(f5[i], f3[i]);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i <= n; i++) f1[a[i]]++;
  for (int i = 1; i < m; i++) f2[min(b[i], b[i + 1])]++;
  sub2::ntt(f1), sub2::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 167772161;
  sub2::intt(f1);
  for (int i = 2e5; i >= 1; i--) f3[i] = sub2::inc(f1[i], f3[i + 1]);
  for (int i = 1; i <= 2e5; i++) f5[i] = sub2::sub(f5[i], f3[i]);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i < n; i++) f1[max(a[i], a[i + 1])]++;
  for (int i = 1; i <= m; i++) f2[b[i]]++;
  sub2::ntt(f1), sub2::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 167772161;
  sub2::intt(f1);
  for (int i = 1; i <= 2e5; i++) f3[i] = sub2::inc(f1[i], f3[i - 1]);
  for (int i = 1; i <= 2e5; i++) f5[i] = sub2::inc(f5[i], f3[i - 1]);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i <= n; i++) f1[a[i]]++;
  for (int i = 1; i < m; i++) f2[max(b[i], b[i + 1])]++;
  sub2::ntt(f1), sub2::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 167772161;
  sub2::intt(f1);
  for (int i = 1; i <= 2e5; i++) f3[i] = sub2::inc(f1[i], f3[i - 1]);
  for (int i = 1; i <= 2e5; i++) f5[i] = sub2::inc(f5[i], f3[i - 1]);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i < n; i++) f1[min(a[i], a[i + 1])]++;
  for (int i = 1; i < m; i++) f2[min(b[i], b[i + 1])]++;
  sub2::ntt(f1), sub2::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 167772161;
  sub2::intt(f1);
  for (int i = 2e5; i >= 1; i--) f3[i] = sub2::inc(f1[i], f3[i + 1]);
  for (int i = 1; i <= 2e5; i++) f5[i] = sub2::inc(f5[i], f3[i]);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1; i < n; i++) f1[max(a[i], a[i + 1])]++;
  for (int i = 1; i < m; i++) f2[max(b[i], b[i + 1])]++;
  sub2::ntt(f1), sub2::ntt(f2);
  for (int i = 0; i < lim; i++) f1[i] = 1ll * f1[i] * f2[i] % 167772161;
  sub2::intt(f1);
  for (int i = 1; i <= 2e5; i++) f3[i] = sub2::inc(f1[i], f3[i - 1]);
  for (int i = 1; i <= 2e5; i++) f5[i] = sub2::sub(f5[i], f3[i - 1]);
  while (q--) {
    int x = read();
    long long pt =
        (f5[x] * sub2::pows(998244353, 167772159)) % 167772161 * 998244353;
    long long pq =
        (f4[x] * sub1::pows(167772161, 998244351)) % 998244353 * 167772161;
    pt = (pt + pq) % (1ll * 167772161 * 998244353);
    if (pt <= 1ll * 167772161 * 998244353 / 2)
      printf("%lld\n", pt);
    else
      printf("%lld\n", pt - 1ll * 167772161 * 998244353);
  }
  return 0;
}
