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 main():
    n, m, s, e, v = [int(x) for x in input().split()]

    stairs = [int(x) for x in input().split()][:s]
    elevs = [int(x) for x in input().split()][:e]

    maximum = 2 * m + n

    from math import ceil
    from bisect import bisect_left, bisect_right

    ans = []

    for _ in range(int(input())):
        x1, y1, x2, y2 = [int(x) for x in input().split()]

        if x1 > x2: x1, x2 = x2, x1
        if y1 > y2: y1, y2 = y2, y1

        diffx = x2 - x1
        diffy = y2 - y1

        res = maximum

        s2 = bisect_right(stairs, y2)
        s1 = bisect_right(stairs, y1)
        e2 = bisect_right(elevs, y2)
        e1 = bisect_right(elevs, y1)

        if e2 > e1:
            res = int(ceil(diffx / v))
        else:
            closeste = maximum
            if e2 < len(elevs):
                closeste = min(closeste, elevs[e2] - y2)
            if e1:
                closeste = min(closeste, y1 - elevs[e1-1])
            res = min(res, closeste * 2 + int(ceil(diffx / v)))

        if s2 > s1:
            res = min(res, diffx)
        else:
            closests = maximum
            if s2 < len(stairs):
                closests = min(closests, stairs[s2] - y2)
            if s1:
                closests = min(closests, y1 - stairs[s1-1])

            res = min(res, closests * 2 + diffx)

        ans.append(res + diffy)
    print("\n".join(map(str, ans)))

if __name__ == '__main__':
    main()
