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

def benpoisk(le, ll, n):
    l, r = 0, le - 1
    if le == 0:
        return 10 ** 18, 10 ** 18
    if n <= ll[l]:
        return ll[l], ll[l]
    if n >= ll[r]:
        return ll[r], ll[r]
    while l + 1 < r:
        h = (l + r) // 2
        if ll[h] > n:
            l = h
        else:
            r = h
    return ll[l], ll[r]
n, m, l, e, u = map(int, input().split())
ll = list(map(int, input().split()))
ee = list(map(int, input().split()))
q = int(input())
for _ in range(q):
    y1, x1, y2, x2 = map(int, input().split())
    if y1 == y2:
        print(abs(x1 - x2))
        continue
    lll, rll = benpoisk(l, ll, x1)
    lee, ree = benpoisk(e, ee, x1)
    lll1, rll1 = benpoisk(l, ll, x1)
    lee1, ree1 = benpoisk(e, ee, x1)
    mnlx = min(abs(x1 - lll) + abs(x2 - lll), abs(x1 - rll) + abs(x2 - rll), abs(x1 - lll1) + abs(x2 - lll1), abs(x1 - rll1) + abs(x2 - rll1))
    mnex = min(abs(x1 - lee) + abs(x2 - lee), abs(x1 - ree) + abs(x2 - ree), abs(x1 - lee1) + abs(x2 - lee1), abs(x1 - ree1) + abs(x2 - ree1))
    mnly = abs(y1 - y2)
    mney = (abs(y1 - y2) + u - 1) // u
    print(min(mnlx + mnly, mnex + mney))