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(void) {
  int n, m, cl, ce, v;
  cin >> n >> m >> cl >> ce >> v;
  vector<int> l;
  l.resize(cl);
  if (cl != 0)
    for (int i = 0; i < cl; i++) cin >> l[i];
  vector<int> e;
  e.resize(ce);
  for (int i = 0; i < ce; i++) cin >> e[i];
  sort(l.begin(), l.end());
  sort(e.begin(), e.end());
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2) {
      cout << abs(y1 - y2) << endl;
      continue;
    }
    int res = 1000 * 1000 * 1000;
    if (cl != 0) {
      int l1 = 0;
      int r1 = cl - 1;
      while (r1 - l1 > 1) {
        int mid = (l1 + r1) >> 1;
        if (l[mid] < y1)
          l1 = mid;
        else
          r1 = mid;
      }
      res = min(res, min(abs(l[l1] - y1) + abs(l[l1] - y2) + abs(x1 - x2),
                         abs(l[r1] - y1) + abs(l[r1] - y2) + abs(x1 - x2)));
    }
    if (cl != 0) {
      int l1 = 0;
      int r1 = cl - 1;
      while (r1 - l1 > 1) {
        int mid = (l1 + r1) >> 1;
        if (l[mid] < y2)
          l1 = mid;
        else
          r1 = mid;
      }
      res = min(res, min(abs(l[l1] - y1) + abs(l[l1] - y2) + abs(x1 - x2),
                         abs(l[r1] - y1) + abs(l[r1] - y2) + abs(x1 - x2)));
    }
    if (ce != 0) {
      int l2 = 0;
      int r2 = ce - 1;
      while (r2 - l2 > 1) {
        int mid = (l2 + r2) >> 1;
        if (e[mid] < y1)
          l2 = mid;
        else
          r2 = mid;
      }
      int temp = abs(x1 - x2) / v;
      if (abs(x1 - x2) % v != 0) temp++;
      res = min(res, min(abs(e[l2] - y1) + abs(e[l2] - y2) + temp,
                         abs(e[r2] - y1) + abs(e[r2] - y2) + temp));
    }
    if (ce != 0) {
      int l2 = 0;
      int r2 = ce - 1;
      while (r2 - l2 > 1) {
        int mid = (l2 + r2) >> 1;
        if (e[mid] < y2)
          l2 = mid;
        else
          r2 = mid;
      }
      int temp = abs(x1 - x2) / v;
      if (abs(x1 - x2) % v != 0) temp++;
      res = min(res, min(abs(e[l2] - y1) + abs(e[l2] - y2) + temp,
                         abs(e[r2] - y1) + abs(e[r2] - y2) + temp));
    }
    cout << res << endl;
  }
  return 0;
}
