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 n, m, cli, cle, d;
int main() {
  cin >> n >> m >> cle >> cli >> d;
  vector<int> li(cli), le(cle);
  for (int i = 0; i < cle; i++) cin >> le[i];
  for (int i = 0; i < cli; i++) cin >> li[i];
  sort(le.begin(), le.end());
  sort(li.begin(), li.end());
  int q;
  cin >> q;
  while (q--) {
    int x1, y1, x2, y2, res = 2e9;
    cin >> y1 >> x1 >> y2 >> x2;
    int j = lower_bound(li.begin(), li.end(), x1) - li.begin();
    if (j != cli)
      res = li[j] - x1 + abs(li[j] - x2) + abs(y1 - y2) / d +
            bool(abs(y1 - y2) % d);
    j--;
    if (j != -1)
      res = min(res, x1 - li[j] + abs(li[j] - x2) + abs(y1 - y2) / d +
                         bool(abs(y1 - y2) % d));
    j = lower_bound(le.begin(), le.end(), x1) - le.begin();
    if (j != cle) res = min(res, le[j] - x1 + abs(le[j] - x2) + abs(y1 - y2));
    j--;
    if (j != -1) res = min(res, x1 - le[j] + abs(le[j] - x2) + abs(y1 - y2));
    cout << res << '\n';
  }
}
