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;
vector<int> Q, Q1;
int g(int a, int b) { return a / b + ((a % b == 0) ? 0 : 1); }
int f(int l, int t, int x, int y, int x1, int y1) {
  int sum = abs(y - l) + g(abs(x - x1), t) + abs(l - y1);
  return sum;
}
int main() {
  int n, m, A, B, v;
  scanf("%d%d%d%d%d", &n, &m, &A, &B, &v);
  for (int i = 0; i < A; i++) {
    int x;
    scanf("%d", &x);
    Q.push_back(x);
  }
  for (int i = 0; i < B; i++) {
    int x;
    scanf("%d", &x);
    Q1.push_back(x);
  }
  sort(Q.begin(), Q.end());
  sort(Q1.begin(), Q1.end());
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int x, y, x1, y1;
    int ans = 1e9 + 7;
    scanf("%d%d%d%d", &x, &y, &x1, &y1);
    auto it = lower_bound(Q.begin(), Q.end(), y);
    if (it != Q.end()) {
      ans = min(ans, f(*it, 1, x, y, x1, y1));
    }
    if (it != Q.begin()) {
      it--;
      ans = min(ans, f(*it, 1, x, y, x1, y1));
    }
    auto it1 = lower_bound(Q1.begin(), Q1.end(), y);
    if (it1 != Q1.end()) {
      ans = min(ans, f(*it1, v, x, y, x1, y1));
    }
    if (it1 != Q1.begin()) {
      it1--;
      ans = min(ans, f(*it1, v, x, y, x1, y1));
    }
    if (x == x1) ans = min(ans, abs(y - y1));
    cout << ans << '\n';
  }
}
