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 l[100010], c[100010];
int main() {
  int n, m;
  int nl, nc, v;
  scanf("%d %d %d %d %d", &n, &m, &nl, &nc, &v);
  for (int i = 0; i < nl; i++) {
    scanf("%d", &l[i]);
  }
  for (int i = 0; i < nc; i++) {
    scanf("%d", &c[i]);
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    int dth = abs(x1 - x2);
    if (y1 > y2) swap(y1, y2);
    int txl = dth;
    int txc = dth / v;
    if (dth % v) txc++;
    int tl = 500000000, tc = 500000000;
    if (dth == 0) {
      printf("%d\n", y2 - y1);
      continue;
    }
    if (nl) {
      int pl = lower_bound(l, l + nl, y1) - l;
      if (pl < nl)
        if (l[pl] <= y2)
          tl = min(txl + y2 - y1, tl);
        else
          tl = min(txl + y2 - y1 + 2 * (l[pl] - y2), tl);
      if (pl - 1 >= 0) tl = min(txl + y2 - y1 + 2 * (y1 - l[pl - 1]), tl);
      pl = lower_bound(l, l + nl, y2) - l;
      if (pl < nl) tl = min(txl + y2 - y1 + 2 * (l[pl] - y2), tl);
    }
    if (nc) {
      int pc = lower_bound(c, c + nc, y1) - c;
      if (pc < nc)
        if (c[pc] <= y2)
          tc = min(txc + y2 - y1, tc);
        else
          tc = min(txc + y2 - y1 + 2 * (c[pc] - y2), tc);
      if (pc - 1 >= 0) tc = min(txc + y2 - y1 + 2 * (y1 - c[pc - 1]), tc);
      pc = lower_bound(c, c + nc, y2) - c;
      if (pc < nc) tc = min(txc + y2 - y1 + 2 * (c[pc] - y2), tc);
    }
    printf("%d\n", min(tl, tc));
  }
  return 0;
}
