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

a1 = input()
a1 = a1.split(' ')
for i in range(len(a1)):
    a1[i] = int(a1[i])

a2 = input()
if a1[2] > 0:
    a2 = a2.split(' ')
    for i in range(len(a2)):
        a2[i] = int(a2[i])
a3 = input()
if a1[3] > 0:        
    a3 = a3.split(' ')
    for i in range(len(a3)):
        a3[i] = int(a3[i])
a4 = input()
a4 = a4.split(' ')
for i in range(len(a4)):
    a4[i] = int(a4[i])
b = []
for i in range(a4[0]):
    b += [input()]
    b[i] = b[i].split(' ')
    for j in range(4):
        b[i][j] = int(b[i][j])

def resiteva():
    t = a1[0]+a1[1]
    s = a1[0]+a1[1]
    d = 0
    f = 0
    for k in range(a4[0]):
        if a1[2] > 0:
            for i in range(len(a2)):
                j = abs(a2[i] - b[k][1]) + abs(a2[i] - b[k][3])
                if j == abs(b[k][1]-b[k][3]):
                    t = j
                    break
                if j < t:
                    t = j
            d = abs(b[k][2] -b[k][0]) + t
        else:
            d = 999999999999
        if a1[3] > 0:
            for i in range(len(a3)):
                u = abs(a3[i] - b[k][1]) + abs(a3[i] - b[k][3])
                if u < s:
                    s = u
                if u == abs(b[k][1]-b[k][3]):
                    s = u
                    break 

            f = abs(b[k][2] -b[k][0])//a1[4] + 1 + s
        else:
            f = 999999999999999
        print(min(f,d))
        f = 0
        d = 0
        t = a1[0]+a1[1]
        s = a1[0]+a1[1]

resiteva()
