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() {
  long long n, m;
  cin >> n >> m;
  double v;
  long long e, s;
  cin >> s >> e >> v;
  vector<long long> S, E;
  if (s != 0)
    for (long long i = 0; i < s; i = i + 1) {
      long long t;
      cin >> t;
      S.push_back(t);
    }
  if (e != 0)
    for (long long i = 0; i < e; i = i + 1) {
      long long t;
      cin >> t;
      E.push_back(t);
    }
  sort(E.begin(), E.end());
  sort(S.begin(), S.end());
  long long q;
  cin >> q;
  for (long long i = 0; i < q; i = i + 1) {
    long long x, y, d, k, l, ans = 1e18;
    cin >> y >> x >> l >> k;
    if (k == min(x, k)) {
      d = x;
      x = k;
      k = d;
    }
    if (y == l) {
      cout << (long long)abs(k - x) << " ";
      continue;
    }
    long long t = 0;
    if (S.size() > 0) {
      long long lp =
                    (long long)(lower_bound(S.begin(), S.end(), x) - S.begin()),
                r = (long long)(lower_bound(S.begin(), S.end(), k) - S.begin());
      if (r - lp > 0) {
        t = abs(y - l) + k - x;
        ans = min(t, ans);
      }
      if (lp > 0) {
        t = abs(S[lp - 1] - x) + abs(S[lp - 1] - k) + abs(y - l);
        ans = min(t, ans);
      }
      if (r < S.size()) {
        t = abs(S[r] - x) + abs(S[r] - k) + abs(y - l);
        ans = min(ans, t);
      }
    }
    if (E.size() > 0) {
      long long lp =
                    (long long)(lower_bound(E.begin(), E.end(), x) - E.begin()),
                r = (long long)(lower_bound(E.begin(), E.end(), k) - E.begin());
      if (r - lp > 0) {
        t = (long long)ceil(abs(y - l) / v) + k - x;
        ans = min(t, ans);
      }
      if (l > 0) {
        t = abs(E[lp - 1] - x) + abs(E[lp - 1] - k) +
            (long long)ceil(abs(y - l) / v);
        ans = min(t, ans);
      }
      if (r < E.size()) {
        t = abs(E[r] - x) + abs(E[r] - k) + (long long)ceil(abs(y - l) / v);
        ans = min(ans, t);
      }
    }
    cout << ans << " ";
  }
}
