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() {
  ios::sync_with_stdio(0);
  int n, m, cl, ce, v;
  cin >> n >> m >> cl >> ce >> v;
  int* l = new int[cl];
  int* e = new int[ce];
  for (int i = 0; i < cl; i++) cin >> l[i];
  for (int i = 0; i < ce; i++) cin >> e[i];
  sort(l, l + cl);
  sort(e, e + ce);
  vector<int> ans;
  int Q;
  cin >> Q;
  for (int q = 0; q < Q; q++) {
    int x1, y1, x2, y2;
    cin >> y1 >> x1 >> y2 >> x2;
    if (y1 == y2) {
      ans.push_back(abs(x1 - x2));
      continue;
    }
    int it1 = upper_bound(l, l + cl, x1) - l;
    int it2 = it1;
    if (it2 != 0) it2--;
    if (it1 == cl) it1--;
    int ans1 = abs(y2 - y1) + min(abs(x1 - l[it1]) + abs(x2 - l[it1]),
                                  abs(x1 - l[it2]) + abs(x2 - l[it2]));
    it1 = upper_bound(e, e + ce, x1) - e;
    it2 = it1;
    if (it2 != 0) it2--;
    if (it1 == ce) it1--;
    int ans2 = (abs(y2 - y1) - 1) / v + 1 +
               min(abs(x1 - e[it1]) + abs(x2 - e[it1]),
                   abs(x1 - e[it2]) + abs(x2 - e[it2]));
    ans.push_back(min(ans1, ans2));
  }
  for (int i = 0; i < (int)ans.size(); i++) cout << ans[i] << '\n';
  return 0;
}
