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 solve(vector<int>& v, int pos, int y2) {
  int dir = upper_bound(v.begin(), v.end(), pos) - v.begin();
  int esq = dir - 1;
  int res = 1e9;
  if (dir < v.size()) res = min(res, abs(v[dir] - pos) + abs(v[dir] - y2));
  if (esq >= 0) res = min(res, abs(v[esq] - pos) + abs(v[esq] - y2));
  return res;
}
int main() {
  vector<int> stair, elevator;
  int n, m, a, b, c;
  cin >> n >> m >> a >> b >> c;
  for (int i = 0; i < a; i++) {
    int x;
    cin >> x;
    stair.push_back(x);
  }
  for (int i = 0; i < b; i++) {
    int x;
    cin >> x;
    elevator.push_back(x);
  }
  sort(stair.begin(), stair.end());
  sort(elevator.begin(), elevator.end());
  int q;
  cin >> q;
  while (q--) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int r1 = 0, r2 = 0;
    r1 += solve(elevator, y1, y2) + ceil(abs(x1 - x2) * 1.0 / c);
    r2 += solve(stair, y1, y2) + abs(abs(x1 - x2));
    cout << min(r1, r2) << endl;
  }
  return 0;
}
