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 java.util.*;

public class Test5{
    static int lesn, lifts, v;
    static int[] lesnpos , liftpos;

    public static void main(String[] z) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt(), b=s.nextInt(), zapr,x1,x2,y1,y2, glif=-1, gles=-1, rles, lles, rlif, llif, f1, f2, f3,f4,f5,f6;
        lesn = s.nextInt();
        lifts = s.nextInt();
        v = s.nextInt();
        lesnpos = new int[lesn];
        liftpos = new int[lifts];
        for(int q=0; q<lesn; q++) lesnpos[q] = s.nextInt();
        for(int q=0; q<lifts; q++) liftpos[q] = s.nextInt();
        zapr = s.nextInt();
        for(int q=0; q<zapr; q++){
            x1 = s.nextInt();
            y1 = s.nextInt();
            x2 = s.nextInt();
            y2 = s.nextInt();
            if(x1==x2) {
                f3 = Math.abs(y1-y2);
                f4 = f3;
                f5=f3;
                f6=f3;
            }
            else {
                f1 = getnumlift(y1);
                f2 = getnumlesn(y1);
                lles = -1;
                rles = -1;
                llif = -1;
                rlif = -1;
                if (lifts > 0) glif = liftpos[f1];
                if (lesn > 0) gles = lesnpos[f2];
                if (lifts > 0) {
                    if (glif > y1) {
                        rlif = liftpos[f1];
                        llif = f1 < 1 ? -1 : liftpos[f1 - 1];
                    } else {
                        llif = liftpos[f1];
                        rlif = f1 + 1 >= lifts ? -1 : liftpos[f1 + 1];
                    }
                }
                if (lesn > 0) {
                    if (gles > y1) {
                        rles = lesnpos[f2];
                        lles = f2 < 1 ? -1 : lesnpos[f2 - 1];
                    } else {
                        lles = lesnpos[f2];
                        rles = f2 + 1 >= lesn ? -1 : lesnpos[f2 + 1];
                    }
                }
                f3 = pytbles(x1, x2, y1, y2, lles);
                f4 = pytbles(x1, x2, y1, y2, rles);
                f5 = pytblift(x1, x2, y1, y2, llif);
                f6 = pytblift(x1, x2, y1, y2, rlif);
            }
            System.out.println(Math.min(Math.min(f3,f4),Math.min(f5,f6)));
        }
    }

    static int getnumlift(int y){
        int i = (lifts+1)/2, k=(i+1)/2, kolvo = (int)(Math.log(lifts)/Math.log(2))+5, c1,c2, d;
        for(int q=0; q<kolvo; k=(k+1)/2, q++){
            d=i;
            c1 = Math.abs(liftpos[i+k>=lifts ? lifts-1 : i+k]-y);
            c2 = Math.abs(liftpos[i-k<0 ? 0 : i-k]-y);
            if(c1<c2) i+=k;
            else i-=k;
            i = i<0 ? 0 : i>=lifts ? lifts-1 : i;
            d = d<0 ? 0 : d>=lifts ? lifts-1 : d;
            if(Math.abs(liftpos[i]-y)>Math.abs(liftpos[d]-y)) i=d;
        }
        return i;
    }
    static int getnumlesn(int y){
        int i = (lesn+1)/2, k=(i+1)/2, kolvo = (int)(Math.log(lesn)/Math.log(2))+5, c1,c2, d;
        for(int q=0; q<kolvo; k=(k+1)/2, q++){
            d=i;
            c1 = Math.abs(lesnpos[i+k>=lesn ? lesn-1 : i+k]-y);
            c2 = Math.abs(lesnpos[i-k<0 ? 0 : i-k]-y);
            if(c1<c2) i+=k;
            else i-=k;
            i = i<0 ? 0 : i>=lesn ? lesn-1 : i;
            d = d<0 ? 0 : d>=lesn ? lesn-1 : d;
            if(Math.abs(lesnpos[i]-y)>Math.abs(lesnpos[d]-y)) i=d;
        }
        return i;
    }

    static int pytbles(int x1, int x2, int y1, int y2, int ylesn){
        return ylesn<0 ? Integer.MAX_VALUE : Math.abs(x1-x2)+Math.abs(y1-ylesn)+Math.abs(ylesn-y2);
    }

    static int pytblift(int x1,int x2, int y1, int y2, int ylift){
        return ylift<0 ? Integer.MAX_VALUE : (int)(Math.ceil(Math.abs(x1-x2)*1.0/v))+Math.abs(y1-ylift)+Math.abs(y2-ylift);
    }
}
