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 read() {
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  int x = c - '0';
  while (c = getchar(), c >= '0' && c <= '9') x = x * 10 + c - '0';
  return x;
}
const int Maxn = 100005;
int Q, N, M, A, B, V, St[Maxn], El[Maxn];
int get(int x, int y) {
  int K = abs(x - y);
  return (K % V ? K + V : K) / V;
}
int ef(int a[], int x, int A) {
  int l = 1, r = A, ans = 0;
  if (l == r) return a[l] < x;
  while (l < r) {
    int mid = l + r >> 1;
    if (a[mid] < x)
      ans = mid, l = mid + 1;
    else
      r = mid;
  }
  return ans;
}
int main() {
  N = read(), M = read(), A = read(), B = read(), V = read();
  for (int i = 1; i <= A; i++) St[i] = read();
  for (int i = 1; i <= B; i++) El[i] = read();
  Q = read();
  for (; Q; Q--) {
    int x = read(), y = read(), fx = read(), fy = read(), Ans = 2e9,
        W1 = abs(x - fx), W2 = get(x, fx);
    int i = ef(St, y, A), j = ef(St, fy, A);
    if (i == j)
      Ans = min(Ans, min(abs(St[i] - y) + W1 + abs(St[i] - fy),
                         abs(St[i + 1] - y) + W1 + abs(St[i + 1] - fy)));
    else
      Ans = min(Ans, abs(St[j] - y) + W1 + abs(St[j] - fy));
    i = ef(El, y, B), j = ef(El, fy, B);
    if (i == j)
      Ans = min(Ans, min(abs(El[i] - y) + W2 + abs(El[i] - fy),
                         abs(El[i + 1] - y) + W2 + abs(El[i + 1] - fy)));
    else
      Ans = min(Ans, abs(El[j] - y) + W2 + abs(El[j] - fy));
    printf("%d\n", Ans);
  }
  return 0;
}
