#include <bits/stdc++.h>
using namespace std;
long long inf = 2147483647;
const long long ll = 9223372036854775807, ninf = 1000000000;
const double eps = 1e-6;
const long long nll = 1000000000000000000;
class MinimizeAbsoluteDifferenceDiv1 {
 public:
  vector<int> findTuple(vector<int> x) {}
};
int main() {
  int a, b, c, d, e;
  while (cin >> a >> b >> c >> d >> e) {
    vector<int> A(c), B(d);
    for (int i = 0; i < c; i++) {
      cin >> A[i];
    }
    for (int i = 0; i < d; i++) {
      cin >> B[i];
    }
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
      int x1, y1, x2, y2;
      cin >> x1 >> y1 >> x2 >> y2;
      int ans = inf;
      if (x1 == x2) {
        ans = abs(y1 - y2);
      } else {
        vector<int>::iterator now;
        now = lower_bound(A.begin(), A.end(), y1);
        if (now != A.end()) {
          ans = min(ans, abs(*now - y1) + abs(*now - y2) + abs(x2 - x1));
        }
        if (now != A.begin()) {
          now--;
          ans = min(ans, abs(*now - y1) + abs(*now - y2) + abs(x2 - x1));
        }
        now = lower_bound(B.begin(), B.end(), y1);
        if (now != B.end()) {
          ans = min(ans, abs(*now - y1) + abs(*now - y2) +
                             (abs(x2 - x1) + e - 1) / e);
        }
        if (now != B.begin()) {
          now--;
          ans = min(ans, abs(*now - y1) + abs(*now - y2) +
                             (abs(x2 - x1) + e - 1) / e);
        }
      }
      cout << ans << '\n';
    }
  }
  return 0;
}
