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;
string s;
int n, m, cl, ce, mo;
vector<int> le;
vector<int> el;
int xs, ys, xf, yf;
int lle() {
  int tim = 0;
  int l = (lower_bound(le.begin(), le.end(), xs) - 1 - le.begin());
  if (l < 0) return 1e9;
  if (le[l] > xs) return 1e9;
  tim = abs(xs - le[l]);
  tim += yf - ys;
  tim += abs(le[l] - xf);
  return tim;
}
int lel() {
  int tim = 0;
  int l = (lower_bound(el.begin(), el.end(), xs) - 1 - el.begin());
  if (l < 0) return 1e9;
  if (el[l] > xs) return 1e9;
  tim = abs(xs - el[l]);
  tim += (yf - ys + mo - 1) / mo;
  tim += abs(el[l] - xf);
  return tim;
}
int rle() {
  int tim = 0;
  int r = (upper_bound(le.begin(), le.end(), xs) - le.begin());
  if (r > cl - 1) return 1e9;
  if (le[r] < xs) return 1e9;
  tim = abs(xs - le[r]);
  tim += yf - ys;
  tim += abs(le[r] - xf);
  return tim;
}
int rel() {
  int tim = 0;
  int r = (upper_bound(el.begin(), el.end(), xs) - el.begin());
  if (r > ce - 1) return 1e9;
  if (el[r] < xs) return 1e9;
  tim = abs(xs - el[r]);
  tim += (yf - ys + mo - 1) / mo;
  tim += abs(el[r] - xf);
  return tim;
}
int main() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  cin >> n >> m >> cl >> ce >> mo;
  for (int i = 0; i < cl; i++) {
    int x;
    cin >> x;
    x--;
    le.push_back(x);
  }
  for (int i = 0; i < ce; i++) {
    int x;
    cin >> x;
    x--;
    el.push_back(x);
  }
  sort(le.begin(), le.end());
  sort(el.begin(), el.end());
  int ttt;
  cin >> ttt;
  for (int kkk = 0; kkk < ttt; kkk++) {
    cin >> xs >> ys >> xf >> yf;
    xs--;
    ys--;
    xf--;
    yf--;
    swap(xs, ys);
    swap(xf, yf);
    int mi = 1e9;
    mi = min(mi, lle());
    mi = min(mi, lel());
    mi = min(mi, rle());
    mi = min(mi, rel());
    cout << mi << endl;
  }
  return 0;
}
