2 10 1 1 1
1
10
1
1 5 1 8
 4 4 1 0 1
1

1
1 2 1 4
 2 5 1 0 1
2

1
1 4 1 5
 10 10 1 8 4
10
2 3 4 5 6 7 8 9
10
1 1 3 1
2 1 7 1
1 1 9 1
7 1 4 1
10 1 7 1
2 1 7 1
3 1 2 1
5 1 2 1
10 1 5 1
6 1 9 1
 2 4 1 1 1
1
4
1
1 2 1 3
 2 2 0 1 1

1
1
1 2 2 2
 1000 1000 1 1 10
1
2
1
1 900 1 1000
 5 5 1 1 1
3
2
1
1 5 1 1
 2 4 1 1 1
1
2
1
2 3 2 4
 4 4 1 0 1
4

5
1 1 2 2
1 3 2 2
3 3 4 3
3 2 2 2
1 2 2 3

3
 2
 1
 3
4
4
3
3
4
3
3
4
3
 1
 3
 100
 4
 1
 6
4
3
5
4

#include <bits/stdc++.h>
using namespace std;
int n, m, cs, ce, v, s[100005], e[100005], q, a, b, c, d, p, w, ans;
int main() {
  scanf("%d%d%d%d%d", &n, &m, &cs, &ce, &v);
  for (int i = 1; i <= cs; i++) scanf("%d", &s[i]);
  for (int i = 1; i <= ce; i++) scanf("%d", &e[i]);
  scanf("%d", &q);
  while (q--) {
    ans = 1E9;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if (a == c) ans = abs(b - d);
    p = lower_bound(s + 1, s + cs + 1, b) - s;
    if (p <= cs) ans = min(ans, abs(s[p] - b) + abs(c - a) + abs(s[p] - d));
    if (p > 1)
      ans = min(ans, abs(s[p - 1] - b) + abs(c - a) + abs(s[p - 1] - d));
    w = lower_bound(e + 1, e + ce + 1, b) - e;
    if (w <= ce)
      ans = min(ans, abs(e[w] - b) + (abs(c - a) - 1) / v + 1 + abs(e[w] - d));
    if (w > 1)
      ans = min(ans, abs(e[w - 1] - b) + (abs(c - a) - 1) / v + 1 +
                         abs(e[w - 1] - d));
    printf("%d\n", ans);
  }
  return 0;
}
