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;
long long n, m, c1, c2, v;
long long a[100010], b[100010];
long long solve(long long sx, long long sy, long long ex, long long ey) {
  if (sx > ex) swap(sx, ex);
  if (sy > ey) swap(sy, ey);
  long long t1, t2, t3, m1, m2, m3, ans1 = INT_MAX, ans2 = INT_MAX;
  if (c1 > 0) {
    t1 = lower_bound(a, a + c1, sy) - a;
    if (t1 == c1) t1--;
    if (a[t1] >= sy && a[t1] <= ey)
      ans1 = ex - sx + ey - sy;
    else if (a[t1] > ey) {
      m1 = ex - sx + 2 * a[t1] - sy - ey;
      ans1 = m1;
      if (t1 > 0) {
        m2 = ex - sx + sy + ey - 2 * a[t1 - 1];
        ans1 = min(m1, m2);
      }
    } else if (a[t1] < sy)
      ans1 = ex - sx + sy + ey - 2 * a[t1];
  }
  if (c2 > 0) {
    t1 = lower_bound(b, b + c2, sy) - b;
    if (t1 == c2) t1--;
    long long v1 = (ex - sx + v - 1) / v;
    if (b[t1] >= sy && b[t1] <= ey)
      ans2 = v1 + ey - sy;
    else if (b[t1] > ey) {
      m1 = v1 + 2 * b[t1] - sy - ey;
      ans2 = m1;
      if (t1 > 0) {
        m2 = ex - sx + sy + ey - 2 * b[t1 - 1];
        ans2 = min(m1, m2);
      }
    } else if (b[t1] < sy)
      ans2 = v1 + sy + ey - 2 * b[t1];
  }
  return min(ans1, ans2);
}
int main() {
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  cin >> n >> m >> c1 >> c2 >> v;
  for (int i = 0; i < c1; i++) cin >> a[i];
  sort(a, a + c1);
  for (int i = 0; i < c2; i++) cin >> b[i];
  sort(b, b + c2);
  long long t;
  cin >> t;
  while (t--) {
    long long u1, v1, u2, v2;
    cin >> u1 >> v1 >> u2 >> v2;
    long long ans = solve(u1, v1, u2, v2);
    printf("%lld\n", ans);
  }
  return 0;
}
