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

import bisect
import math
n,m,c1,ce,v=map(int,input().split())
posstairs=list(map(int,input().split()))
posele=list(map(int,input().split()))
q=int(input())
for i in range(0,q):
    y1,x1,y2,x2=map(int,input().split())
    if x2<x1:
        x1,x2=x2,x1
    if ce!=0:
        ind1=bisect.bisect_left(posele,x1)
        if ind1==ce:
            ind1-=1
        t1=abs(x1-posele[ind1])+abs(posele[ind1]-x2)+math.ceil(abs(y2-y1)/v)
    if c1!=0:
        ind2=bisect.bisect_left(posstairs,x1)
        if ind2==c1:
            ind2-=1
        t2=abs(x1-posstairs[ind2])+abs(posstairs[ind2]-x2)+abs(y2-y1)
    if y1==y2:
        print(abs(x2-x1))
    elif ce!=0 and c1!=0:
        print(min(t1,t2))
    elif ce!=0:
        print(t1)
    else :
        print(t2)