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, k, m, x, y, z, b[205020], a[205050], w, v, u, T, f,
    mi = -2000000000000000000, ans;
int main() {
  cin >> n >> m >> x >> y >> z;
  for (int i = 0; i < x; ++i) cin >> a[i];
  for (int i = 0; i < y; ++i) cin >> b[i];
  sort(a, a + x);
  sort(b, b + y);
  cin >> T;
  for (int i = 0; i < T; ++i) {
    int x1, y1, x2, y2, l, ans1 = 1000000000, ans2 = 1000000000;
    cin >> y1 >> x1 >> y2 >> x2;
    if (x1 > x2) swap(x1, x2);
    if (x) {
      l = lower_bound(a, a + x, x1) - a;
      if (l == x) --l;
      if (a[l] > x1 && a[l] < x2)
        ans1 = x2 - x1 + abs(y2 - y1);
      else {
        if (l) {
          if (x1 - a[l - 1] < a[l] - x2)
            ans1 = 2 * (x1 - a[l - 1]) + x2 - x1 + abs(y2 - y1);
          else
            ans1 = 2 * (a[l] - x2) + x2 - x1 + abs(y2 - y1);
        } else {
          if (a[0] > x1)
            ans1 = 2 * (a[0] - x2) + x2 - x1 + abs(y2 - y1);
          else
            ans1 = 2 * (x1 - a[0]) + x2 - x1 + abs(y2 - y1);
        }
      }
    }
    if (y) {
      l = lower_bound(b, b + y, x1) - b;
      if (l == y) --l;
      if (b[l] > x1 && b[l] < x2)
        ans2 = x2 - x1 + ceil(abs(y2 - y1) * 1.0 / z);
      else {
        ans2 = x2 - x1 + ceil(abs(y2 - y1) * 1.0 / z);
        if (l) {
          if (x1 - b[l - 1] < b[l] - x2)
            ans2 += 2 * (x1 - b[l - 1]);
          else
            ans2 += 2 * (b[l] - x2);
        } else {
          if (b[0] > x1)
            ans2 += 2 * (b[0] - x2);
          else
            ans2 += 2 * (x1 - b[0]);
        }
      }
    }
    ans = min(ans1, ans2);
    cout << ans << endl;
  }
  return 0;
}
