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>
#pragma GCC optimize(2)
using namespace std;
int a[100005];
int b[100005];
int main() {
  long long n, m, nn, mm, v;
  cin >> n >> m >> nn >> mm >> v;
  for (int i = 0; i < nn; ++i) cin >> a[i];
  for (int i = 0; i < mm; ++i) cin >> b[i];
  int q;
  cin >> q;
  long long sx, sy, ex, ey;
  for (int i = 0; i < q; ++i) {
    cin >> sx >> sy >> ex >> ey;
    long long mmin = 0x3f3f3f3f;
    int pos1 = lower_bound(a, a + nn, sy) - a;
    int pos2 = lower_bound(b, b + mm, sy) - b;
    if (pos1 > 0)
      mmin = min(mmin,
                 abs(sy - a[pos1 - 1]) + abs(ey - a[pos1 - 1]) + abs(ex - sx));
    if (pos1 < nn)
      mmin = min(mmin, abs(a[pos1] - sy) + abs(ey - a[pos1]) + abs(ex - sx));
    if (pos2 > 0)
      mmin = min(mmin, abs(sy - b[pos2 - 1]) + abs(ey - b[pos2 - 1]) +
                           (long long)ceil(1.0 * abs(ex - sx) / v));
    if (pos2 < mm)
      mmin = min(mmin, abs(b[pos2] - sy) + abs(ey - b[pos2]) +
                           (long long)ceil(1.0 * abs(ex - sx) / v));
    if (sx == ex) mmin = abs(sy - ey);
    cout << mmin << endl;
  }
  return 0;
}
