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 std::sort;
int n, m, cl, ce, v, q;
int flr[100005], elv[100005];
int sol(int x1, int y1, int x2, int y2) {
  int l, r, m;
  int costf, coste;
  l = -1;
  r = cl;
  while (l + 1 < r) {
    m = (l + r) / 2;
    if (flr[m] <= y1)
      l = m;
    else
      r = m;
  }
  if (l == -1) l = 0;
  if (flr[l] == y1)
    r = l;
  else if (flr[l] > y1)
    r = l - 1;
  else if (flr[l] < y1)
    r = l + 1;
  if (r < 0) r = 0;
  if (r >= cl) r = cl - 1;
  costf = ((((y1 - flr[l]) > 0 ? (y1 - flr[l]) : (0 - (y1 - flr[l]))) +
            ((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) +
            ((y2 - flr[l]) > 0 ? (y2 - flr[l]) : (0 - (y2 - flr[l])))) <
                   (((y1 - flr[r]) > 0 ? (y1 - flr[r]) : (0 - (y1 - flr[r]))) +
                    ((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) +
                    ((y2 - flr[r]) > 0 ? (y2 - flr[r]) : (0 - (y2 - flr[r]))))
               ? (((y1 - flr[l]) > 0 ? (y1 - flr[l]) : (0 - (y1 - flr[l]))) +
                  ((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) +
                  ((y2 - flr[l]) > 0 ? (y2 - flr[l]) : (0 - (y2 - flr[l]))))
               : (((y1 - flr[r]) > 0 ? (y1 - flr[r]) : (0 - (y1 - flr[r]))) +
                  ((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) +
                  ((y2 - flr[r]) > 0 ? (y2 - flr[r]) : (0 - (y2 - flr[r])))));
  l = -1;
  r = ce;
  while (l + 1 < r) {
    m = (l + r) / 2;
    if (elv[m] <= y1)
      l = m;
    else
      r = m;
  }
  if (l == -1) l = 0;
  if (elv[l] == y1)
    r = l;
  else if (elv[l] > y1)
    r = l - 1;
  else if (elv[l] < y1)
    r = l + 1;
  if (r < 0) r = 0;
  if (r >= ce) r = ce - 1;
  coste = ((((y1 - elv[l]) > 0 ? (y1 - elv[l]) : (0 - (y1 - elv[l]))) +
            ((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) / v +
            (((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) % v != 0) +
            ((y2 - elv[l]) > 0 ? (y2 - elv[l]) : (0 - (y2 - elv[l])))) <
                   (((y1 - elv[r]) > 0 ? (y1 - elv[r]) : (0 - (y1 - elv[r]))) +
                    ((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) / v +
                    (((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) % v != 0) +
                    ((y2 - elv[r]) > 0 ? (y2 - elv[r]) : (0 - (y2 - elv[r]))))
               ? (((y1 - elv[l]) > 0 ? (y1 - elv[l]) : (0 - (y1 - elv[l]))) +
                  ((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) / v +
                  (((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) % v != 0) +
                  ((y2 - elv[l]) > 0 ? (y2 - elv[l]) : (0 - (y2 - elv[l]))))
               : (((y1 - elv[r]) > 0 ? (y1 - elv[r]) : (0 - (y1 - elv[r]))) +
                  ((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) / v +
                  (((x2 - x1) > 0 ? (x2 - x1) : (0 - (x2 - x1))) % v != 0) +
                  ((y2 - elv[r]) > 0 ? (y2 - elv[r]) : (0 - (y2 - elv[r])))));
  if (cl == 0)
    return coste;
  else if (ce == 0)
    return costf;
  return ((costf) < (coste) ? (costf) : (coste));
}
int main() {
  int x1, y1, x2, y2;
  scanf("%d %d %d %d %d", &n, &m, &cl, &ce, &v);
  for (int i = 0; i < cl; ++i) scanf("%d", &flr[i]);
  for (int i = 0; i < ce; ++i) scanf("%d", &elv[i]);
  scanf("%d", &q);
  for (int i = 0; i < q; ++i) {
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    printf("%d\n", sol(x1, y1, x2, y2));
  }
}
