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 os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

def bs2(arr,v,l1):
    low = 1
    high = l1
    while low <= high:
        mid = (low+high)/2
        if arr[mid-1]>v:
            high = mid-1
        else:
            low = mid+1

    return min(max(high-1,0),l1-1)
def bs(arr,v,l1):
    low = 1
    high = l1
    while low <= high:
        mid = (low+high)/2
        if arr[mid-1]>=v:
            high = mid-1
        else:
            low = mid+1
    return min(max(low-1,0),l1-1)


def solve(a,b,c,d):
    ans = 1e9
    if s>0:
        pos1 = bs(ls,b,s)
        for p in range(pos1-1,pos1+2):
            p = p%s
            v1 = ls[p-1]
            ans = min(ans,abs(c-a)+abs(v1-b)+abs(v1-d))

    if e>0:
        pos2 = bs(le,b,e)
        for p in range(pos2-1,pos2+2):
            p = p%e
            v1 = le[p-1]
            ans = min(ans,(abs(c-a)+v-1)/v+abs(v1-b)+abs(v1-d))

    return ans


n,m,s,e,v = map(int,raw_input().split(" "))
if s >0 :
    ls = map(int,raw_input().split(" "))
else:
    ls = []
    raw_input()
if e >0:
    le = map(int,raw_input().split(" "))
else:
    le = []
    raw_input()
q = int(input())

for _ in range(q):
    a,b,c,d = map(int,raw_input().split(" "))
    print solve(a,b,c,d)

  	 				   							 	 		    	 		