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;
long long n, m, cl, ce, cv, q;
vector<long long> arrl, arre;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> cl >> ce >> cv;
  arrl.resize(cl + !cl, 0), arre.resize(ce + !ce, 0);
  for (int i = 0; i < cl; i++) cin >> arrl[i];
  for (int i = 0; i < ce; i++) cin >> arre[i];
  cin >> q;
  while (q--) {
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2)
      cout << abs(y1 - y2) << endl;
    else {
      long long nrl, ans = 1e9 + 9;
      long long ind = lower_bound(arrl.begin(), arrl.end(), y1) - arrl.begin();
      if (ind == cl)
        ans = min(ans, abs(arrl[ind - 1] - y1) + abs(arrl[ind - 1] - y2) +
                           abs(x2 - x1));
      else if (ind == 0)
        ans =
            min(ans, abs(arrl[ind] - y1) + abs(arrl[ind] - y2) + abs(x2 - x1));
      else {
        ans =
            min(ans, abs(arrl[ind] - y1) + abs(arrl[ind] - y2) + abs(x2 - x1));
        ans = min(ans, abs(arrl[ind - 1] - y1) + abs(arrl[ind - 1] - y2) +
                           abs(x2 - x1));
      }
      ind = lower_bound(arre.begin(), arre.end(), y1) - arre.begin();
      if (ind == ce)
        ans = min(ans, abs(arre[ind - 1] - y1) + abs(arre[ind - 1] - y2) +
                           abs((long long)ceil(1.0 * (x2 - x1) / cv)));
      else if (ind == 0)
        ans = min(ans, abs(arre[ind] - y1) + abs(arre[ind] - y2) +
                           abs((long long)ceil(1.0 * (x2 - x1) / cv)));
      else {
        ans = min(ans, abs(arre[ind] - y1) + abs(arre[ind] - y2) +
                           abs((long long)ceil(1.0 * (x2 - x1) / cv)));
        ans = min(ans, abs(arre[ind - 1] - y1) + abs(arre[ind - 1] - y2) +
                           abs((long long)ceil(1.0 * (x2 - x1) / cv)));
      }
      cout << ans << endl;
    }
  }
}
