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() {
  int n, m, u, q, cl, ce;
  int l[100000];
  int e[100000];
  vector<pair<int, int> > x1;
  vector<pair<int, int> > x2;
  cin >> n >> m >> cl >> ce >> u;
  for (int i = 1; i <= cl; i++) {
    cin >> l[i];
  }
  for (int i = 1; i <= ce; i++) {
    cin >> e[i];
  }
  cin >> q;
  x1.push_back({-1, -1});
  x2.push_back({-1, -1});
  for (int i = 1; i <= q; i++) {
    int xx1, xx2, yy1, yy2;
    cin >> xx1 >> yy1 >> xx2 >> yy2;
    x1.push_back({xx1, yy1});
    x2.push_back({xx2, yy2});
  }
  for (int i = 1; i <= q; i++) {
    int manhl =
        abs(x1[i].first - x2[i].first) + abs(x1[i].second - x2[i].second);
    int midd = 0;
    int left = 1;
    int right = cl + 1;
    int ans = 0;
    while (1) {
      midd = (left + right) / 2;
      int rast = abs(l[midd] - x2[i].second) + abs(x1[i].first - x2[i].first) +
                 abs(l[midd] - x1[i].second);
      if (rast > manhl) {
        right = midd - 1;
      } else if (rast <= manhl) {
        ans = rast;
        break;
      }
      if (left > right) {
        ans = rast;
        break;
      }
    }
    int manhe = abs(x1[i].second - x2[i].second) +
                (abs(x1[i].first - x2[i].first) / u) +
                (abs(x1[i].first - x2[i].first) % u);
    int anse = 0;
    left = 1;
    right = ce + 1;
    while (1) {
      midd = (left + right) / 2;
      int rast =
          abs(e[midd] - x2[i].second) + (abs(x1[i].first - x2[i].first) / u) +
          (abs(x1[i].first - x2[i].first) % u) + abs(e[midd] - x1[i].second);
      if (rast > manhe) {
        right = midd - 1;
      } else if (rast <= manhe) {
        anse = rast;
        break;
      }
      if (left > right) {
        anse = rast;
        break;
      }
    }
    if (x2[i].first == x1[i].first) ans = abs(x1[i].second - x2[i].second);
    if (cl > 0 && ce > 0) {
      cout << min(ans, anse) << endl;
    } else if (cl > 0)
      cout << ans << endl;
    else
      cout << anse << endl;
  }
  return 0;
}
