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, cl, ce, v, q;
int a[100050], b[100050];
int x1, y1, x2, y2;
int main() {
  scanf("%d %d %d %d %d", &n, &m, &cl, &ce, &v);
  for (int i = 1; i <= cl; i++) scanf("%d", &b[i]);
  for (int i = 1; i <= ce; i++) scanf("%d", &a[i]);
  b[cl + 1] = a[ce + 1] = 1000000000;
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    int ymi = min(y1, y2), yma = max(y1, y2);
    int key2 = lower_bound(b + 1, b + 1 + cl, ymi) - b;
    int key1 = lower_bound(a + 1, a + 1 + ce, ymi) - a;
    int mi = 1000000000;
    int dis = abs(x2 - x1);
    if (a[key1] <= yma) {
      int ans = ((dis % v == 0) ? dis / v : dis / v + 1) + abs(y1 - y2);
      mi = min(ans, mi);
    } else {
      int ans = ((dis % v == 0) ? dis / v : dis / v + 1) + abs(y1 - y2), f;
      if (key1 == 1)
        f = abs(a[key1] - yma) * 2;
      else
        f = min(abs(a[key1] - yma), abs(a[key1 - 1] - ymi)) * 2;
      mi = min(mi, ans + f);
    }
    if (b[key2] <= yma) {
      int ans = abs(x1 - x2) + abs(y1 - y2);
      mi = min(mi, ans);
    } else {
      int ans = abs(x1 - x2) + abs(y1 - y2), f;
      if (key2 == 1)
        f = abs(b[key2] - yma) * 2;
      else
        f = min(abs(b[key2] - yma), abs(b[key2 - 1] - ymi)) * 2;
      mi = min(mi, ans + f);
    }
    printf("%d\n", mi);
  }
}
