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;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double eps = (double)1e-9;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int N = 200500;
int n, m;
int lim, q;
int a, c[N];
int b, d[N];
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> a >> b >> lim;
  for (int i = 1; i <= a; i++) cin >> c[i];
  for (int i = 1; i <= b; i++) cin >> d[i];
  cin >> q;
  for (int i = 1; i <= q; i++) {
    int x, y, xx, yy;
    cin >> x >> y >> xx >> yy;
    int ans = inf, l, r, res;
    l = 1, r = a, res = -1;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (c[mid] < y) {
        res = mid;
        l = mid + 1;
      } else
        r = mid - 1;
    }
    if (res != -1)
      ans = min(ans, abs(x - xx) + abs(y - c[res]) + abs(yy - c[res]));
    l = 1, r = a, res = -1;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (c[mid] > y) {
        res = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    if (res != -1)
      ans = min(ans, abs(x - xx) + abs(y - c[res]) + abs(yy - c[res]));
    l = 1, r = b, res = -1;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (d[mid] < y) {
        res = mid;
        l = mid + 1;
      } else
        r = mid - 1;
    }
    if (res != -1)
      ans = min(ans, (abs(x - xx) + lim - 1) / lim + abs(y - d[res]) +
                         abs(yy - d[res]));
    l = 1, r = b, res = -1;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (d[mid] > y) {
        res = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    if (res != -1)
      ans = min(ans, (abs(x - xx) + lim - 1) / lim + abs(y - d[res]) +
                         abs(yy - d[res]));
    if (x == xx) ans = min(ans, abs(y - yy));
    cout << ans << endl;
  }
  return 0;
}
