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 main() {
  int n, m, s, e, v, as[100010], ae[100010], q;
  scanf("%d %d %d %d %d", &n, &m, &s, &e, &v);
  for (int i = 0; i < s; ++i) scanf("%d", as + i);
  for (int i = 0; i < e; ++i) scanf("%d", ae + i);
  scanf("%d", &q);
  int x1, y1, x2, y2, l, r, k, x, jwb;
  while (q--) {
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    l = 0;
    r = e - 1;
    swap(x1, y1);
    swap(x2, y2);
    if (x1 > x2) {
      swap(x1, x2);
      swap(y1, y2);
    }
    if (y1 == y2) {
      printf("%d\n", x2 - x1);
      continue;
    }
    if (e) {
      while (l < r) {
        k = (l + r) >> 1;
        if (ae[k] > x1)
          r = k;
        else
          l = k + 1;
      }
      if (ae[l] > x1 && ae[l] < x2) {
        jwb = x2 - x1 + (abs(y1 - y2) - 1) / v + 1;
      } else if (ae[l] < x1) {
        jwb = x1 - ae[l] + x2 - ae[l] + (abs(y1 - y2) - 1) / v + 1;
        ++l;
        if (l < e) {
          jwb = min(jwb, ae[l] - x1 + ae[l] - x2 + (abs(y1 - y2) - 1) / v + 1);
        }
      } else {
        jwb = ae[l] - x1 + ae[l] - x2 + (abs(y1 - y2) - 1) / v + 1;
        --l;
        if (l >= 0) {
          jwb = min(jwb, x1 - ae[l] + x2 - ae[l] + (abs(y1 - y2) - 1) / v + 1);
        }
      }
    }
    if (s) {
      l = 0;
      r = s - 1;
      while (l < r) {
        k = (l + r) >> 1;
        if (as[k] > x1)
          r = k;
        else
          l = k + 1;
      }
      if (as[l] > x1 && as[l] < x2) {
        jwb = min(jwb, x2 - x1 + y2 - y1);
      } else if (as[l] < x1) {
        jwb = min(jwb, y2 - y1 + x1 - as[l] + x2 - as[l]);
        ++l;
        if (l < s) {
          jwb = min(jwb, y2 - y1 + as[l] - x1 + as[l] - x2);
        }
      } else {
        jwb = min(jwb, y2 - y1 + x1 - as[l] + x2 - as[l]);
        ++l;
        if (l < s) {
          jwb = min(jwb, y2 - y1 + as[l] - x1 + as[l] - x2);
        }
      }
    }
    printf("%d\n", jwb);
  }
  return 0;
}
