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);
  cin.tie(0);
  int n, m, cl, ce, v;
  cin >> n >> m >> cl >> ce >> v;
  vector<int> long long(cl);
  vector<int> ee(ce);
  for (int i = 0; i < cl; ++i) cin >> long long[i];
  for (int i = 0; i < ce; ++i) cin >> ee[i];
  int q, x1, y1, x2, y2;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2)
      cout << abs(y2 - y1) << '\n';
    else {
      int path1 = 0x3f3f3f3f, path2 = 0x3f3f3f3f, path3 = 0x3f3f3f3f,
          path4 = 0x3f3f3f3f;
      vector<int>::iterator ul, ue, dl, de;
      if (long long.size()) {
        if (y1 < y2)
          ul = lower_bound((long long).begin(), (long long).end(), y1);
        else
          ul = lower_bound((long long).begin(), (long long).end(), y2);
        dl = ul - 1;
        if (*ul != 0) path1 = abs(*ul - y1) + abs(*ul - y2) + abs(x1 - x2);
        if (*dl != 0) path2 = abs(*dl - y1) + abs(*dl - y2) + abs(x1 - x2);
      }
      if (ee.size()) {
        if (y1 < y2)
          ue = lower_bound((ee).begin(), (ee).end(), y1);
        else
          ue = lower_bound((ee).begin(), (ee).end(), y2);
        de = ue - 1;
        if (*ue != 0)
          path3 = abs(*ue - y1) + abs(*ue - y2) + ((abs(x1 - x2) - 1) / v) + 1;
        if (*de != 0)
          path4 = abs(*de - y1) + abs(*de - y2) + ((abs(x1 - x2) - 1) / v) + 1;
      }
      cout << min(min(path1, path2), min(path3, path4)) << '\n';
    }
  }
  return 0;
}
