#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <set>
using namespace std;
const int maxn=1e5+7;
typedef long long ll;
const int L=1e8+5;
int qq[maxn];
int q1[maxn];
int q2[maxn];
int c1,c2,c3;
int louz(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q1[min1];
}

int louy(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q1[max1];
}

int dianz(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q2[min1];
}

int diany(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q2[max1];
}
int main()
{
    //e����Note���ᵽ�ĺϷ�����ʽ
    //freopen("in.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int i,j;
    int T,k,t2,t3,t4,f1,f2,f3,f4;
    int r,c;
    int n,m,K;
    int v;
    cin >> n>> m >> c1>> c2>> v;
    for(i=1;i<=c1;i++)
    cin >> q1[i]; //¥��
    q1[0]=0;
    q1[c1+1]=1e8+5;
    q1[c1+2]=1e8+5;
    for(i=1;i<=c2;i++)
    cin >> q2[i];
    q2[0]=0;
    q2[c2+1]=1e8+5;
    q2[c2+2]=1e8+5;
    int left1,left2,right1,right2,mid1,mid2;
    int Q;
    cin >> Q;
    sort(q1,q1+c1+3);
    sort(q2,q2+c2+3);
    int x,y,x1,y1;
    int res;
    for(i=1;i<=Q;i++){
    cin >> x >> y >>x1 >>y1;
    //cout << x << "  "<<y <<"   " <<x1 <<"   " <<y1<< endl;
    swap(x,y);
    swap(x1,y1);
    if(y==y1){
    cout << abs(x1-x)<< endl;continue;
    }
    res=1e9;
    int min1,max1;
    int cha=abs(y1-y); //�ߵ����ߵ�
   // cout <<" ~ " << y1 <<"      "<<y << endl;
    int l1,r1; //louz,louy.dianz,diany
    l1=louz(x);
    r1=louy(x);
    if(l1!=0)res=min(res,abs(x-l1)+abs(x1-l1)+abs(y1-y));
    if(r1!=L)res=min(res,abs(x-r1)+abs(x1-r1)+abs(y1-y));
    //cout <<l1 <<"  ¥�� " <<r1<< endl;
    //cout <<"emmmm  " <<abs(x-r1) <<"  "<<abs(x1-r1) <<"  "<<abs(y1-y) << endl;
    //cout << "before" << res<< "  and " <<l1 <<"   "<<r1<<endl;
    int time1=0;
    l1=dianz(x);
    r1=diany(x);
    if(cha%v==0){
        time1=cha/v;
    }else{
        time1=cha/v+1;
    }
   // cout <<"~~ " <<l1 <<"    " <<r1 << endl;
    //cout <<"~ " << time1<<"   " <<res<< endl;
    if(l1!=0)res=min(res,time1+abs(x-l1)+abs(x1-l1));
    if(r1!=L)res=min(res,time1+abs(x-r1)+abs(x1-r1));
  //  cout <<x<<"  to "<<l1 <<"  ���� " <<r1<< endl;
   //cout << time1 <<"   " << abs(x-r1) <<  "    " <<  abs(x1-r1) <<"  "<<x1<< endl;
    if(res<0)
    while(1);
    if(res>1e9)
    while(1);
    cout << max(res,0) << endl;
    }
    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <set>
using namespace std;
const int maxn=1e5+7;
typedef long long ll;
int qq[maxn];
int q1[maxn];
int q2[maxn];
int c1,c2,c3;
int louz(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q1[min1];
}

int louy(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q1[max1];
}

int dianz(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q2[min1];
}

int diany(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q2[max1];
}
int main()
{
    //e����Note���ᵽ�ĺϷ�����ʽ
    //freopen("in.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int i,j;
    int T,k,t2,t3,t4,f1,f2,f3,f4;
    int r,c;
    int n,m,K;
    int v;
    cin >> n>> m >> c1>> c2>> v;
    for(i=1;i<=c1;i++)
    cin >> q1[i]; //¥��
    q1[0]=-1e9;
    q1[c1+1]=2e9;
    q1[c1+2]=2e9;
    for(i=1;i<=c2;i++)
    cin >> q2[i];
    q2[0]=-1e9;
    q2[c2+1]=2e9;
    q2[c2+2]=2e9;
    int left1,left2,right1,right2,mid1,mid2;
    int Q;
    cin >> Q;
    sort(q1,q1+c1+3);
    sort(q2,q2+c2+3);
    int x,y,x1,y1;
    int res;
    for(i=1;i<=Q;i++){
    cin >> x >> y >>x1 >>y1;
    //cout << x << "  "<<y <<"   " <<x1 <<"   " <<y1<< endl;
    swap(x,y);
    swap(x1,y1);
    if(y==y1){
    cout << abs(x1-x)<< endl;continue;
    }
    res=1e9;
    int min1,max1;
    int cha=abs(y1-y); //�ߵ����ߵ�
   // cout <<" ~ " << y1 <<"      "<<y << endl;
    int l1,r1; //louz,louy.dianz,diany
    l1=louz(x);
    r1=louy(x);
    if(l1!=-1e9)res=min(res,abs(x-l1)+abs(x1-l1)+abs(y1-y));
    if(r1!=2e9)res=min(res,abs(x-r1)+abs(x1-r1)+abs(y1-y));
    //cout <<l1 <<"  ¥�� " <<r1<< endl;
    //cout <<"emmmm  " <<abs(x-r1) <<"  "<<abs(x1-r1) <<"  "<<abs(y1-y) << endl;
    //cout << "before" << res<< "  and " <<l1 <<"   "<<r1<<endl;
    int time1=0;
    l1=dianz(x);
    r1=diany(x);
    if(cha%v==0){
        time1=cha/v;
    }else{
        time1=cha/v+1;
    }
   // cout <<"~~ " <<l1 <<"    " <<r1 << endl;
    //cout <<"~ " << time1<<"   " <<res<< endl;
    if(l1!=-1e9)res=min(res,time1+abs(x-l1)+abs(x1-l1));
    if(r1!=2e9)res=min(res,time1+abs(x-r1)+abs(x1-r1));
  //  cout <<x<<"  to "<<l1 <<"  ���� " <<r1<< endl;
   //cout << time1 <<"   " << abs(x-r1) <<  "    " <<  abs(x1-r1) <<"  "<<x1<< endl;
    if(res<0)
    while(1);
    //if(res>1e9)
    //while(1);
    cout << res << endl;
    }
    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <set>
using namespace std;
const int maxn=1e5+7;
typedef long long ll;
const int L=1e8+5;
int qq[maxn];
int q1[maxn];
int q2[maxn];
int c1,c2,c3;
int louz(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q1[min1];
}

int louy(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q1[max1];
}

int dianz(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q2[min1];
}

int diany(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q2[max1];
}
int main()
{
    //e����Note���ᵽ�ĺϷ�����ʽ
    //freopen("in.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int i,j;
    int T,k,t2,t3,t4,f1,f2,f3,f4;
    int r,c;
    int n,m,K;
    int v;
    cin >> n>> m >> c1>> c2>> v;
    for(i=1;i<=c1;i++)
    cin >> q1[i]; //¥��
    q1[0]=0;
    q1[c1+1]=1e8+5;
    q1[c1+2]=1e8+5;
    for(i=1;i<=c2;i++)
    cin >> q2[i];
    q2[0]=0;
    q2[c2+1]=1e8+5;
    q2[c2+2]=1e8+5;
    int left1,left2,right1,right2,mid1,mid2;
    int Q;
    cin >> Q;
    sort(q1,q1+c1+3);
    sort(q2,q2+c2+3);
    int x,y,x1,y1;
    int res;
    for(i=1;i<=Q;i++){
    cin >> x >> y >>x1 >>y1;
    //cout << x << "  "<<y <<"   " <<x1 <<"   " <<y1<< endl;
    swap(x,y);
    swap(x1,y1);
    if(y==y1){
    cout << abs(x1-x)<< endl;continue;
    }
    res=1e9;
    int min1,max1;
    int cha=abs(y1-y); //�ߵ����ߵ�
   // cout <<" ~ " << y1 <<"      "<<y << endl;
    int l1,r1; //louz,louy.dianz,diany
    l1=louz(x);
    r1=louy(x);
    if(l1!=0)res=min(res,abs(x-l1)+abs(x1-l1)+abs(y1-y));
    if(r1!=L)res=min(res,abs(x-r1)+abs(x1-r1)+abs(y1-y));
    //cout <<l1 <<"  ¥�� " <<r1<< endl;
    //cout <<"emmmm  " <<abs(x-r1) <<"  "<<abs(x1-r1) <<"  "<<abs(y1-y) << endl;
    //cout << "before" << res<< "  and " <<l1 <<"   "<<r1<<endl;
    int time1=0;
    l1=dianz(x);
    r1=diany(x);
    if(cha%v==0){
        time1=cha/v;
    }else{
        time1=cha/v+1;
    }
   // cout <<"~~ " <<l1 <<"    " <<r1 << endl;
    //cout <<"~ " << time1<<"   " <<res<< endl;
    if(l1!=0)res=min(res,time1+abs(x-l1)+abs(x1-l1));
    if(r1!=L)res=min(res,time1+abs(x-r1)+abs(x1-r1));
  //  cout <<x<<"  to "<<l1 <<"  ���� " <<r1<< endl;
   //cout << time1 <<"   " << abs(x-r1) <<  "    " <<  abs(x1-r1) <<"  "<<x1<< endl;
    //if(res<0)
    //while(1);
    //if(res>1e9)
    //while(1);
    cout << max(res,0) << endl;
    }
    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <set>
using namespace std;
const int maxn=1e5+7;
typedef long long ll;
int qq[maxn];
int q1[maxn];
int q2[maxn];
int c1,c2,c3;
int louz(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+1;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q1[min1];
}

int louy(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+1;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q1[max1];
}

int dianz(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+1;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q2[min1];
}

int diany(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+1;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q2[max1];
}
int main()
{
    //e����Note���ᵽ�ĺϷ�����ʽ
    //freopen("in.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int i,j;
    int T,k,t2,t3,t4,f1,f2,f3,f4;
    int r,c;
    int n,m,K;
    int v;
    cin >> n>> m >> c1>> c2>> v;
    for(i=1;i<=c1;i++)
    cin >> q1[i]; //¥��
    q1[0]=0;
    q1[c1+1]=1e9;
    for(i=1;i<=c2;i++)
    cin >> q2[i];
    q2[0]=0;
    q2[c2+1]=1e9;
    int left1,left2,right1,right2,mid1,mid2;
    int Q;
    cin >> Q;
    int x,y,x1,y1;
    int res;
    for(i=1;i<=Q;i++){
    cin >> x >> y >>x1 >>y1;
    //cout << x << "  "<<y <<"   " <<x1 <<"   " <<y1<< endl;
    swap(x,y);
    swap(x1,y1);
    if(y==y1){
    cout << abs(x1-x)<< endl;continue;
    }
    res=1e9;
    int min1,max1;
    int cha=abs(y1-y); //�ߵ����ߵ�
   // cout <<" ~ " << y1 <<"      "<<y << endl;
    int l1,r1; //louz,louy.dianz,diany
    l1=louz(x);
    r1=louy(x);
    if(l1!=0)res=min(res,abs(x-l1)+abs(x1-l1)+abs(y1-y));
    if(r1!=1e9)res=min(res,abs(x-r1)+abs(x1-r1)+abs(y1-y));
    //cout <<l1 <<"  ¥�� " <<r1<< endl;
    //cout <<"emmmm  " <<abs(x-r1) <<"  "<<abs(x1-r1) <<"  "<<abs(y1-y) << endl;
    //cout << "before" << res<< "  and " <<l1 <<"   "<<r1<<endl;
    int time1=0;
    l1=dianz(x);
    r1=diany(x);
    if(cha%v==0){
        time1=cha/v;
    }else{
        time1=cha/v+1;
    }
    //cout <<"~~ " <<l1 <<"    " <<r1 << endl;
    //cout <<"~ " << time1<<"   " <<res<< endl;
    if(l1!=0)res=min(res,time1+abs(x-l1)+abs(x1-l1));
    if(r1!=1e9)res=min(res,time1+abs(x-r1)+abs(x1-r1));
  //  cout <<x<<"  to "<<l1 <<"  ���� " <<r1<< endl;
   //cout << time1 <<"   " << abs(x-r1) <<  "    " <<  abs(x1-r1) <<"  "<<x1<< endl;
    cout << res << endl;
    }
    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <set>
using namespace std;
const int maxn=1e5+7;
typedef long long ll;
int qq[maxn];
int q1[maxn];
int q2[maxn];
int c1,c2,c3;
int louz(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q1[min1];
}

int louy(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q1[max1];
}

int dianz(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q2[min1];
}

int diany(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q2[max1];
}
int main()
{
    //e����Note���ᵽ�ĺϷ�����ʽ
    //freopen("in.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int i,j;
    int T,k,t2,t3,t4,f1,f2,f3,f4;
    int r,c;
    int n,m,K;
    int v;
    cin >> n>> m >> c1>> c2>> v;
    for(i=1;i<=c1;i++)
    cin >> q1[i]; //¥��
    q1[0]=-1e9;
    q1[c1+1]=2e9;
    q1[c1+2]=2e9;
    for(i=1;i<=c2;i++)
    cin >> q2[i];
    q2[0]=-1e9;
    q2[c2+1]=2e9;
    q2[c2+2]=2e9;
    int left1,left2,right1,right2,mid1,mid2;
    int Q;
    cin >> Q;
    sort(q1,q1+c1+3);
    sort(q2,q2+c2+3);
    int x,y,x1,y1;
    int res;
    for(i=1;i<=Q;i++){
    cin >> x >> y >>x1 >>y1;
    //cout << x << "  "<<y <<"   " <<x1 <<"   " <<y1<< endl;
    swap(x,y);
    swap(x1,y1);
    if(y==y1){
    cout << abs(x1-x)<< endl;continue;
    }
    res=1e9;
    int min1,max1;
    int cha=abs(y1-y); //�ߵ����ߵ�
   // cout <<" ~ " << y1 <<"      "<<y << endl;
    int l1,r1; //louz,louy.dianz,diany
    l1=louz(x);
    r1=louy(x);
    if(l1!=-1e9)res=min(res,abs(x-l1)+abs(x1-l1)+abs(y1-y));
    if(r1!=2e9)res=min(res,abs(x-r1)+abs(x1-r1)+abs(y1-y));
    //cout <<l1 <<"  ¥�� " <<r1<< endl;
    //cout <<"emmmm  " <<abs(x-r1) <<"  "<<abs(x1-r1) <<"  "<<abs(y1-y) << endl;
    //cout << "before" << res<< "  and " <<l1 <<"   "<<r1<<endl;
    int time1=0;
    l1=dianz(x);
    r1=diany(x);
    if(cha%v==0){
        time1=cha/v;
    }else{
        time1=cha/v+1;
    }
   // cout <<"~~ " <<l1 <<"    " <<r1 << endl;
    //cout <<"~ " << time1<<"   " <<res<< endl;
    if(l1!=-1e9)res=min(res,time1+abs(x-l1)+abs(x1-l1));
    if(r1!=2e9)res=min(res,time1+abs(x-r1)+abs(x1-r1));
  //  cout <<x<<"  to "<<l1 <<"  ���� " <<r1<< endl;
   //cout << time1 <<"   " << abs(x-r1) <<  "    " <<  abs(x1-r1) <<"  "<<x1<< endl;
    if(res<0)
    while(1);
    if(res>1e9)
    while(1);
    cout << res << endl;
    }
    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <set>
using namespace std;
const int maxn=1e7+7;
typedef long long ll;
const int L=1e9;
int qq[maxn];
int q1[maxn];
int q2[maxn];
int c1,c2,c3;
int louz(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+1;
    int min1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]<=x){
        min1=max(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q1[min1];
}

int louy(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+1;
    int max1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]>=x){
        max1=min(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q1[max1];
}

int dianz(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+1;
    int min1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]<=x){
        min1=max(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q2[min1];
}

int diany(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+1;
    int max1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]>=x){
        max1=min(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q2[max1];
}
int main()
{
    //e����Note���ᵽ�ĺϷ�����ʽ
    //freopen("in.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int i,j;
    int T,k,t2,t3,t4,f1,f2,f3,f4;
    int r,c;
    int n,m,K;
    int v;
    cin >> n>> m >> c1>> c2>> v;
    for(i=1;i<=c1;i++)
    cin >> q1[i]; //¥��
    q1[0]=0;
    q1[c1+1]=L;
    for(i=1;i<=c2;i++)
    cin >> q2[i];
    q2[0]=0;
    q2[c2+1]=L;
    int left1,left2,right1,right2,mid1,mid2;
    int Q;
    cin >> Q;
    int x,y,x1,y1;
    int res;
    for(i=1;i<=Q;i++){
    cin >> x >> y >>x1 >>y1;
    //cout << x << "  "<<y <<"   " <<x1 <<"   " <<y1<< endl;
    swap(x,y);
    swap(x1,y1);
    if(y==y1){
    cout << abs(x1-x)<< endl;continue;
    }
    res=1e9;
    int min1,max1;
    int cha=abs(y1-y); //�ߵ����ߵ�
   // cout <<" ~ " << y1 <<"      "<<y << endl;
    int l1,r1; //louz,louy.dianz,diany
    l1=louz(x);
    r1=louy(x);
    if(l1!=0)res=min(res,abs(x-l1)+abs(x1-l1)+abs(y1-y));
    if(r1!=L)res=min(res,abs(x-r1)+abs(x1-r1)+abs(y1-y));
    //cout <<l1 <<"  ¥�� " <<r1<<  "  " <<res<<endl;    //cout <<"emmmm  " <<abs(x-r1) <<"  "<<abs(x1-r1) <<"  "<<abs(y1-y) << endl;
    //cout << "before" << res<< "  and " <<l1 <<"   "<<r1<<endl;
    int time1=0;
    l1=dianz(x);
    r1=diany(x);
    if(cha%v==0){
        time1=cha/v;
    }else{
        time1=cha/v+1;
    }
   // cout <<"~~ " <<l1 <<"    " <<r1 << endl;
    //cout <<"~ " << time1<<"   " <<res<< endl;
    if(l1!=0)res=min(res,time1+abs(x-l1)+abs(x1-l1));
    if(r1!=L)res=min(res,time1+abs(x-r1)+abs(x1-r1));
  //  cout <<x<<"  to "<<l1 <<"  ���� " <<r1<< endl;
   //cout << time1 <<"   " << abs(x-r1) <<  "    " <<  abs(x1-r1) <<"  "<<x1<< endl;
    /*if(res<0)
    while(1);
    if(res>1e9)
    while(1);*/
    cout << res << endl;
    }
    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <set>
using namespace std;
const int maxn=1e5+7;
typedef long long ll;
const int L=1e8+5;
int qq[maxn];
int q1[maxn];
int q2[maxn];
int c1,c2,c3;
int louz(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q1[min1];
}

int louy(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q1[max1];
}

int dianz(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q2[min1];
}

int diany(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q2[max1];
}
int main()
{
    //e����Note���ᵽ�ĺϷ�����ʽ
    //freopen("in.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int i,j;
    int T,k,t2,t3,t4,f1,f2,f3,f4;
    int r,c;
    int n,m,K;
    int v;
    cin >> n>> m >> c1>> c2>> v;
    for(i=1;i<=c1;i++)
    cin >> q1[i]; //¥��
    q1[0]=0;
    q1[c1+1]=1e8+5;
    q1[c1+2]=1e8+5;
    for(i=1;i<=c2;i++)
    cin >> q2[i];
    q2[0]=0;
    q2[c2+1]=1e8+5;
    q2[c2+2]=1e8+5;
    int left1,left2,right1,right2,mid1,mid2;
    int Q;
    cin >> Q;
    sort(q1,q1+c1+2);
    sort(q2,q2+c2+2);
    int x,y,x1,y1;
    int res;
    for(i=1;i<=Q;i++){
    cin >> x >> y >>x1 >>y1;
    //cout << x << "  "<<y <<"   " <<x1 <<"   " <<y1<< endl;
    swap(x,y);
    swap(x1,y1);
    if(y==y1){
    cout << abs(x1-x)<< endl;continue;
    }
    res=1e9;
    int min1,max1;
    int cha=abs(y1-y); //�ߵ����ߵ�
   // cout <<" ~ " << y1 <<"      "<<y << endl;
    int l1,r1; //louz,louy.dianz,diany
    l1=louz(x);
    r1=louy(x);
    if(l1!=0)res=min(res,abs(x-l1)+abs(x1-l1)+abs(y1-y));
    if(r1!=L)res=min(res,abs(x-r1)+abs(x1-r1)+abs(y1-y));
    //cout <<l1 <<"  ¥�� " <<r1<< endl;
    //cout <<"emmmm  " <<abs(x-r1) <<"  "<<abs(x1-r1) <<"  "<<abs(y1-y) << endl;
    //cout << "before" << res<< "  and " <<l1 <<"   "<<r1<<endl;
    int time1=0;
    l1=dianz(x);
    r1=diany(x);
    if(cha%v==0){
        time1=cha/v;
    }else{
        time1=cha/v+1;
    }
   // cout <<"~~ " <<l1 <<"    " <<r1 << endl;
    //cout <<"~ " << time1<<"   " <<res<< endl;
    if(l1!=0)res=min(res,time1+abs(x-l1)+abs(x1-l1));
    if(r1!=L)res=min(res,time1+abs(x-r1)+abs(x1-r1));
  //  cout <<x<<"  to "<<l1 <<"  ���� " <<r1<< endl;
   //cout << time1 <<"   " << abs(x-r1) <<  "    " <<  abs(x1-r1) <<"  "<<x1<< endl;
    if(res<0)
    while(1);
    //if(res>1e9)
    //while(1);
    cout << max(res,0) << endl;
    }
    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <set>
using namespace std;
const int maxn=1e5+7;
typedef long long ll;
int qq[maxn];
int q1[maxn];
int q2[maxn];
int c1,c2,c3;
int louz(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q1[min1];
}

int louy(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q1[max1];
}

int dianz(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q2[min1];
}

int diany(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q2[max1];
}
int main()
{
    //e����Note���ᵽ�ĺϷ�����ʽ
    //freopen("in.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int i,j;
    int T,k,t2,t3,t4,f1,f2,f3,f4;
    int r,c;
    int n,m,K;
    int v;
    cin >> n>> m >> c1>> c2>> v;
    for(i=1;i<=c1;i++)
    cin >> q1[i]; //¥��
    q1[0]=-1e9;
    q1[c1+1]=2e9;
    q1[c1+2]=2e9;
    for(i=1;i<=c2;i++)
    cin >> q2[i];
    q2[0]=-1e9;
    q2[c2+1]=2e9;
    q2[c2+2]=2e9;
    int left1,left2,right1,right2,mid1,mid2;
    int Q;
    cin >> Q;
    sort(q1,q1+c1+3);
    sort(q1,q1+c1+3);
    int x,y,x1,y1;
    int res;
    for(i=1;i<=Q;i++){
    cin >> x >> y >>x1 >>y1;
    //cout << x << "  "<<y <<"   " <<x1 <<"   " <<y1<< endl;
    swap(x,y);
    swap(x1,y1);
    if(y==y1){
    cout << abs(x1-x)<< endl;continue;
    }
    res=1e9;
    int min1,max1;
    int cha=abs(y1-y); //�ߵ����ߵ�
   // cout <<" ~ " << y1 <<"      "<<y << endl;
    int l1,r1; //louz,louy.dianz,diany
    l1=louz(x);
    r1=louy(x);
    if(l1!=-1e9)res=min(res,abs(x-l1)+abs(x1-l1)+abs(y1-y));
    if(r1!=2e9)res=min(res,abs(x-r1)+abs(x1-r1)+abs(y1-y));
    //cout <<l1 <<"  ¥�� " <<r1<< endl;
    //cout <<"emmmm  " <<abs(x-r1) <<"  "<<abs(x1-r1) <<"  "<<abs(y1-y) << endl;
    //cout << "before" << res<< "  and " <<l1 <<"   "<<r1<<endl;
    int time1=0;
    l1=dianz(x);
    r1=diany(x);
    if(cha%v==0){
        time1=cha/v;
    }else{
        time1=cha/v+1;
    }
   // cout <<"~~ " <<l1 <<"    " <<r1 << endl;
    //cout <<"~ " << time1<<"   " <<res<< endl;
    if(l1!=-1e9)res=min(res,time1+abs(x-l1)+abs(x1-l1));
    if(r1!=2e9)res=min(res,time1+abs(x-r1)+abs(x1-r1));
  //  cout <<x<<"  to "<<l1 <<"  ���� " <<r1<< endl;
   //cout << time1 <<"   " << abs(x-r1) <<  "    " <<  abs(x1-r1) <<"  "<<x1<< endl;
    if(res<0)
    while(1);
    if(res>1e9)
    while(1);
    cout << res << endl;
    }
    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <set>
using namespace std;
const int maxn=1e7+7;
typedef long long ll;
const int L=1e8+5;
int qq[maxn];
int q1[maxn];
int q2[maxn];
int c1,c2,c3;
int louz(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q1[min1];
}

int louy(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q1[max1];
}

int dianz(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q2[min1];
}

int diany(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q2[max1];
}
int main()
{
    //e����Note���ᵽ�ĺϷ�����ʽ
    //freopen("in.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int i,j;
    int T,k,t2,t3,t4,f1,f2,f3,f4;
    int r,c;
    int n,m,K;
    int v;
    cin >> n>> m >> c1>> c2>> v;
    for(i=1;i<=c1;i++)
    cin >> q1[i]; //¥��
    q1[0]=0;
    q1[c1+1]=1e8+5;
    q1[c1+2]=1e8+5;
    for(i=1;i<=c2;i++)
    cin >> q2[i];
    q2[0]=0;
    q2[c2+1]=1e8+5;
    q2[c2+2]=1e8+5;
    int left1,left2,right1,right2,mid1,mid2;
    int Q;
    cin >> Q;
    sort(q1,q1+c1+3);
    sort(q2,q2+c2+3);
    int x,y,x1,y1;
    int res;
    for(i=1;i<=Q;i++){
    cin >> x >> y >>x1 >>y1;
    //cout << x << "  "<<y <<"   " <<x1 <<"   " <<y1<< endl;
    swap(x,y);
    swap(x1,y1);
    if(y==y1){
    cout << abs(x1-x)<< endl;continue;
    }
    res=1e9;
    int min1,max1;
    int cha=abs(y1-y); //�ߵ����ߵ�
   // cout <<" ~ " << y1 <<"      "<<y << endl;
    int l1,r1; //louz,louy.dianz,diany
    l1=louz(x);
    r1=louy(x);
    if(l1!=0)res=min(res,abs(x-l1)+abs(x1-l1)+abs(y1-y));
    if(r1!=L)res=min(res,abs(x-r1)+abs(x1-r1)+abs(y1-y));
    //cout <<l1 <<"  ¥�� " <<r1<< endl;
    //cout <<"emmmm  " <<abs(x-r1) <<"  "<<abs(x1-r1) <<"  "<<abs(y1-y) << endl;
    //cout << "before" << res<< "  and " <<l1 <<"   "<<r1<<endl;
    int time1=0;
    l1=dianz(x);
    r1=diany(x);
    if(cha%v==0){
        time1=cha/v;
    }else{
        time1=cha/v+1;
    }
   // cout <<"~~ " <<l1 <<"    " <<r1 << endl;
    //cout <<"~ " << time1<<"   " <<res<< endl;
    if(l1!=0)res=min(res,time1+abs(x-l1)+abs(x1-l1));
    if(r1!=L)res=min(res,time1+abs(x-r1)+abs(x1-r1));
  //  cout <<x<<"  to "<<l1 <<"  ���� " <<r1<< endl;
   //cout << time1 <<"   " << abs(x-r1) <<  "    " <<  abs(x1-r1) <<"  "<<x1<< endl;
    if(res<0)
    while(1);
    if(res>1e9)
    while(1);
    cout << res << endl;
    }
    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <set>
using namespace std;
const int maxn=1e7+7;
typedef long long ll;
const int L=1e8+5;
int qq[maxn];
int q1[maxn];
int q2[maxn];
int c1,c2,c3;
int louz(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q1[min1];
}

int louy(int x){
    int left1,right1,mid1;
    left1=0;right1=c1+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q1[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q1[max1];
}

int dianz(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+2;
    int min1=1e9;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]<=x){
        min1=min(min1,mid1);
        left1=mid1+1;
        }else{
        right1=mid1-1;
        }
    }
    return q2[min1];
}

int diany(int x){
    int left1,right1,mid1;
    left1=0;right1=c2+2;
    int max1=0;
    while(right1>=left1){
        mid1=(left1+right1)/2;
        if(q2[mid1]>=x){
        max1=max(max1,mid1);
        right1=mid1-1;
        }else{
        left1=mid1+1;
        }
    }
    return q2[max1];
}
int main()
{
    //e����Note���ᵽ�ĺϷ�����ʽ
    //freopen("in.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int i,j;
    int T,k,t2,t3,t4,f1,f2,f3,f4;
    int r,c;
    int n,m,K;
    int v;
    cin >> n>> m >> c1>> c2>> v;
    for(i=1;i<=c1;i++)
    cin >> q1[i]; //¥��
    q1[0]=0;
    for(i=c1+1;i<=c1+1e5;i++)
    q1[i]=1e8+5;
    q1[c1+2]=1e8+5;
    for(i=1;i<=c2;i++)
    cin >> q2[i];
    q2[0]=0;
    for(i=c2+1;i<=c2+1e5;i++)
    q2[i]=1e8+5;
    q2[c2+2]=1e8+5;
    int left1,left2,right1,right2,mid1,mid2;
    int Q;
    cin >> Q;
    //sort(q1,q1+c1+100000);
    //sort(q2,q2+c2+100000);
    int x,y,x1,y1;
    int res;
    for(i=1;i<=Q;i++){
    cin >> x >> y >>x1 >>y1;
    //cout << x << "  "<<y <<"   " <<x1 <<"   " <<y1<< endl;
    swap(x,y);
    swap(x1,y1);
    if(y==y1){
    cout << abs(x1-x)<< endl;continue;
    }
    res=1e9;
    int min1,max1;
    int cha=abs(y1-y); //�ߵ����ߵ�
   // cout <<" ~ " << y1 <<"      "<<y << endl;
    int l1,r1; //louz,louy.dianz,diany
    l1=louz(x);
    r1=louy(x);
    if(l1!=0)res=min(res,abs(x-l1)+abs(x1-l1)+abs(y1-y));
    if(r1!=L)res=min(res,abs(x-r1)+abs(x1-r1)+abs(y1-y));
    //cout <<l1 <<"  ¥�� " <<r1<< endl;
    //cout <<"emmmm  " <<abs(x-r1) <<"  "<<abs(x1-r1) <<"  "<<abs(y1-y) << endl;
    //cout << "before" << res<< "  and " <<l1 <<"   "<<r1<<endl;
    int time1=0;
    l1=dianz(x);
    r1=diany(x);
    if(cha%v==0){
        time1=cha/v;
    }else{
        time1=cha/v+1;
    }
   // cout <<"~~ " <<l1 <<"    " <<r1 << endl;
    //cout <<"~ " << time1<<"   " <<res<< endl;
    if(l1!=0)res=min(res,time1+abs(x-l1)+abs(x1-l1));
    if(r1!=L)res=min(res,time1+abs(x-r1)+abs(x1-r1));
  //  cout <<x<<"  to "<<l1 <<"  ���� " <<r1<< endl;
   //cout << time1 <<"   " << abs(x-r1) <<  "    " <<  abs(x1-r1) <<"  "<<x1<< endl;
    if(res<0)
    while(1);
    if(res>1e9)
    while(1);
    cout << res << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define N 100010
using namespace std;

int n,m,t,d,v,vt,vd,len,x3,x4,y3,y4,a[N],b[N],q;
int main()
{
	scanf("%d%d%d%d%d",&n,&m,&t,&d,&v);
	for (int i=1;i<=t;i++) scanf("%d",a+i);
	for (int i=1;i<=d;i++) scanf("%d",b+i);
	scanf("%d",&q);
	while (q--)
	{
		scanf("%d%d%d%d",&x3,&y3,&x4,&y4);
		int len=abs(x3-x4),vd=len%v?len/v+1:len/v,vt=len;
		if (y3>y4) swap(y3,y4);
		int t1=lower_bound(a+1,a+t+1,y3)-a,t2=lower_bound(a+1,a+t+1,y4)-a
		, 	d1=lower_bound(b+1,b+d+1,y3)-b,d2=lower_bound(b+1,b+d+1,y4)-b;
		if (d1&&d1<=d&&b[d1]<y4)
		{
			printf("%d\n",y4-y3+vd);continue;
		}
		d1--;
		int ans=1<<30;
		if (d1&&d1<=d) ans=min(ans,y4-y3+vd+2*(y3-b[d1]));
		if (d2&&d2<=d) ans=min(ans,y4-y3+vd+2*(b[d2]-y4));
		if (t1&&t1<=t&&a[t1]<y4) ans=min(ans,y4-y3+vt);
		t1--;
		if (t1&&t1<=t) ans=min(ans,y4-y3+vt+2*(y3-a[t1]));
		if (t2&&t2<=t) ans=min(ans,y4-y3+vt+2*(a[t2]-y4));
		printf("%d\n",ans);
	}
}


#include<bits/stdc++.h>
#define N 100010
using namespace std;

int n,m,t,d,v,vt,vd,len,x3,x4,y3,y4,a[N],b[N],q;
int main()
{
	scanf("%d%d%d%d%d",&n,&m,&t,&d,&v);
	for (int i=1;i<=t;i++) scanf("%d",a+i);
	for (int i=1;i<=d;i++) scanf("%d",b+i);
	scanf("%d",&q);
	while (q--)
	{
		scanf("%d%d%d%d",&x3,&y3,&x4,&y4);
		int len=abs(x3-x4),vd=len%v?len/v+1:len/v,vt=len;
		if (y3>y4) swap(y3,y4);
		int t1=lower_bound(a+1,a+t+1,y3)-a,t2=lower_bound(a+1,a+t+1,y4)-a
		, 	d1=lower_bound(b+1,b+d+1,y3)-b,d2=lower_bound(b+1,b+t+1,y4)-b;
		if (d1&&d1<=d&&b[d1]<y4)
		{
			printf("%d\n",y4-y3+vd);continue;
		}
		d1--;
		int ans=1<<30;
		if (d1&&d1<=d) ans=min(ans,y4-y3+vd+2*(y3-b[d1]));
		if (d2&&d2<=d) ans=min(ans,y4-y3+vd+2*(b[d2]-y4));
		if (t1&&t1<=t&&a[t1]<y4) ans=min(ans,y4-y3+vt);
		t1--;
		if (t1&&t1<=t) ans=min(ans,y4-y3+vt+2*(y3-a[t1]));
		if (t2&&t2<=t) ans=min(ans,y4-y3+vt+2*(a[t2]-y4));
		printf("%d\n",ans);
	}
}


#include<bits/stdc++.h>
#define N 100010
using namespace std;

int n,m,t,d,v,vt,vd,len,x3,x4,y3,y4,a[N],b[N],q;
int main()
{
	scanf("%d%d%d%d%d",&n,&m,&t,&d,&v);
	for (int i=1;i<=t;i++) scanf("%d",a+i);
	for (int i=1;i<=d;i++) scanf("%d",b+i);
	scanf("%d",&q);
	while (q--)
	{
		scanf("%d%d%d%d",&x3,&y3,&x4,&y4);
		int len=abs(x3-x4),vd=len%v?len/v+1:len/v,vt=len;
		if (y3>y4) swap(y3,y4);
		int t1=lower_bound(a+1,a+t+1,y3)-a,t2=lower_bound(a+1,a+t+1,y4)-a
		, 	d1=lower_bound(b+1,b+d+1,y3)-b,d2=lower_bound(b+1,b+d+1,y4)-b;
		if (d1&&d1<=d&&b[d1]<y4)
		{
			printf("%d\n",y4-y3+vd);continue;
		}
		d1--;
		int ans=1<<30;
		if (d1&&d1<=d) ans=min(ans,y4-y3+vd+2*(y3-b[d1]));
		if (d2&&d2<=d) ans=min(ans,y4-y3+vd+2*(b[d2]-y4));
		if (t1&&t1<=t&&a[t1]<y4) ans=min(ans,y4-y3+vt);
		t1--;
		if (t1&&t1<=t) ans=min(ans,y4-y3+vt+2*(y3-a[t1]));
		if (t2&&t2<=t) ans=min(ans,y4-y3+vt+2*(a[t2]-y4));
		if (x3==x4) printf("%d\n",y4-y3); else printf("%d\n",ans);
	}
}


#include<bits/stdc++.h>
#define N 100010
using namespace std;

int n,m,t,d,v,vt,vd,len,x3,x4,y3,y4,a[N],b[N],q;
int main()
{
	scanf("%d%d%d%d%d",&n,&m,&t,&d,&v);
	for (int i=1;i<=t;i++) scanf("%d",a+i);
	for (int i=1;i<=d;i++) scanf("%d",b+i);
	scanf("%d",&q);
	while (q--)
	{
		scanf("%d%d%d%d",&x3,&y3,&x4,&y4);
		int len=abs(x3-x4),vd=len%v?len/v+1:len/v,vt=len;
		if (y3>y4) swap(y3,y4);
		int t1=lower_bound(a+1,a+t+1,y3)-a,t2=lower_bound(a+1,a+t+1,y4)-a
		, 	d1=lower_bound(b+1,b+d+1,y3)-b,d2=lower_bound(b+1,b+d+1,y4)-b;
		if (d1&&d1<=d&&b[d1]<y4)
		{
			printf("%d\n",y4-y3+vd);continue;
		}
		d1--;
		int ans=1<<30;
		if (d1&&d1<=d) ans=min(ans,y4-y3+vd+2*(y3-b[d1]));
		if (d2&&d2<=d) ans=min(ans,y4-y3+vd+2*(b[d2]-y4));
		if (t1&&t1<=t&&a[t1]<y4) ans=min(ans,y4-y3+vt);
		t1--;
		if (t1&&t1<=t) ans=min(ans,y4-y3+vt+2*(y3-a[t1]));
		if (t2&&t2<=t) ans=min(ans,y4-y3+vt+2*(a[t2]-y4));
		if (x3==x4) printf("%d\n",len); else printf("%d\n",ans);
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define MAX -1
vector < long long> stairs,elevators;
 long long FindClosestStairs( long long searchFor){
	 long long index=distance(stairs.begin(),lower_bound(stairs.begin(),stairs.end(),searchFor));
	if(index==stairs.size()){
		if(index==0)return MAX;
		return stairs[index-1];
	}
	 long long R=stairs[index];
	if(index==0)return R;
	 long long L=stairs[index-1];

	if(abs(searchFor-L)>abs(searchFor-R))return R;
	return L;
}
 long long FindClosestElevator( long long searchFor){
	 long long index=distance(elevators.begin(),lower_bound(elevators.begin(),elevators.end(),searchFor));
	if(index==elevators.size()){
		if(index==0)return MAX;
		return elevators[index-1];
	}
	 long long R=elevators[index];
	if(index==0)return R;
	 long long L=elevators[index-1];

	if(abs(searchFor-L)>abs(searchFor-R))return R;
	return L;
}
inline  long long mceil2( long long a, long long b){
	return a/b+(a%b>0);
}
int main(){
	ios_base::sync_with_stdio(false);
	 long long n,m,c1,c2,v;
	cin >>n>>m>>c1>>c2>>v;
	stairs.resize(c1);
	elevators.resize(c2);
	for( long long i=0;i<c1;i++){
		cin >>stairs[i];
	}
	for( long long i=0;i<c2;i++){
		cin >>elevators[i];
	}

	 long long q;
	cin >>q;
	for( long long qveri=0;qveri<q;qveri++){

		 long long x1,y1,x2,y2;
		cin >>y1>>x1>>y2>>x2;
		 long long e1=FindClosestElevator(x1);
		 long long s1=FindClosestStairs(x1);
		 long long e2=FindClosestElevator(x2);
		 long long s2=FindClosestStairs(x2);
		//cout <<"ELEVATOR 1,2: "<<e1<<" "<<e2<<endl;
		 long long S1,S2,S3,S4;
		bool OK1,OK2,OK3,OK4;
		OK1=s1>=0;
		OK2=s2>=0;
		OK3=e1>=0;
		OK4=e2>=0;
		S1=abs(x1-s1)+abs(y1-y2)+abs(x2-s1);
		S2=abs(x1-s2)+abs(y1-y2)+abs(x2-s2);

		S3=abs(x1-e1)+abs(x2-e1)+mceil2(abs(y1-y2),v);
		S4=abs(x1-e2)+abs(x2-e2)+mceil2(abs(y1-y2),v);
		//cout <<"S3="<<abs(x1-e1)<<"+"<<abs(x2-e1)<<"+"<<mceil2(abs(y1-y2),v)<<endl;
		//cout <<"S1: "<<S1<<endl;
		//cout <<"S2: "<<S2<<endl;
		//cout <<"S3(E1): "<<S3<<endl;
		//cout <<"S4(E2): "<<S4<<endl;
		 long long Sol;
		if(OK1)Sol=S1;
		if(OK2)Sol=S2;
		if(OK3)Sol=S3;
		if(OK4)Sol=S4;
		if(OK1)Sol=min(Sol,S1);
		if(OK2)Sol=min(Sol,S2);
		if(OK3)Sol=min(Sol,S3);
		if(OK4)Sol=min(Sol,S4);
		cout <<Sol<<endl;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define MAX -1
vector < long long> stairs,elevators;
 long long FindClosestStairsL( long long searchFor){
	 long long index=distance(stairs.begin(),lower_bound(stairs.begin(),stairs.end(),searchFor));
	if(index==stairs.size()){
		if(index==0)return MAX;
		return stairs[index-1];
	}
	 //long long R=stairs[index];
	if(index==0)return MAX;
	 long long L=stairs[index-1];

	return L;
}
 long long FindClosestStairsR( long long searchFor){
	 long long index=distance(stairs.begin(),lower_bound(stairs.begin(),stairs.end(),searchFor));
	if(index==stairs.size()){
		if(index==0)return MAX;
		return  MAX;
	}
	 long long R=stairs[index];

	 //long long L=stairs[index-1];

	return R;
}

 long long FindClosestElevatorR( long long searchFor){
	 long long index=distance(elevators.begin(),lower_bound(elevators.begin(),elevators.end(),searchFor));
	if(index==elevators.size()){
		if(index==0)return MAX;
		return MAX;
	}
	 long long R=elevators[index];
	if(index==0)return R;

	return R;

}

 long long FindClosestElevatorL( long long searchFor){
	 long long index=distance(elevators.begin(),lower_bound(elevators.begin(),elevators.end(),searchFor));
	if(index==elevators.size()){
		if(index==0)return MAX;
		return elevators[index-1];
	}
	 long long R=elevators[index];
	if(index==0)return MAX;
	 long long L=elevators[index-1];

	return L;
}

inline  long long mceil2( long long a, long long b){
	return a/b+(a%b>0);
}
int main(){
	ios_base::sync_with_stdio(false);
	 long long n,m,c1,c2,v;
	cin >>n>>m>>c1>>c2>>v;
	stairs.resize(c1);
	elevators.resize(c2);
	for( long long i=0;i<c1;i++){
		cin >>stairs[i];
	}
	for( long long i=0;i<c2;i++){
		cin >>elevators[i];
	}

	 long long q;
	cin >>q;
	for( long long qveri=0;qveri<q;qveri++){

		 long long x1,y1,x2,y2;
		cin >>y1>>x1>>y2>>x2;
		 long long e1L=FindClosestElevatorL(x1);
		 long long e1R=FindClosestElevatorR(x1);

		 long long s1L=FindClosestStairsL(x1);
 		 long long s1R=FindClosestStairsR(x1);

		 long long e2L=FindClosestElevatorL(x2);
		 long long e2R=FindClosestElevatorR(x2);

		 long long s2L=FindClosestStairsL(x2);
		 long long s2R=FindClosestStairsR(x2);
		//cout <<"ELEVATOR 1,2: "<<e1<<" "<<e2<<endl;
	 	long long S1L,S1R,S2L,S2R,S3L,S3R,S4L,S4R;
		bool OK1L,OK1R,OK2L,OK2R,OK3L,OK3R,OK4L,OK4R;
		OK1L=s1L>=0;
		OK1R=s1R>=0;
		OK2L=s2L>=0;
		OK2R=s2R>=0;

		OK3L=e1L>=0;
		OK3R=e1R>=0;
		OK4L=e2L>=0;

		OK4R=e2R>=0;
		S1L=abs(x1-s1L)+abs(y1-y2)+abs(x2-s1L);
		S1R=abs(x1-s1R)+abs(y1-y2)+abs(x2-s1R);
		S2L=abs(x1-s2L)+abs(y1-y2)+abs(x2-s2L);
		S2R=abs(x1-s2R)+abs(y1-y2)+abs(x2-s2R);

		S3L=abs(x1-e1L)+abs(x2-e1L)+mceil2(abs(y1-y2),v);
		S3R=abs(x1-e1R)+abs(x2-e1R)+mceil2(abs(y1-y2),v);
		S4L=abs(x1-e2L)+abs(x2-e2L)+mceil2(abs(y1-y2),v);
		S4R=abs(x1-e2R)+abs(x2-e2R)+mceil2(abs(y1-y2),v);
		//cout <<"S3="<<abs(x1-e1)<<"+"<<abs(x2-e1)<<"+"<<mceil2(abs(y1-y2),v)<<endl;
		//cout <<"S1: "<<S1<<endl;
		//cout <<"S2: "<<S2<<endl;
		//cout <<"S3(E1): "<<S3<<endl;
		//cout <<"S4(E2): "<<S4<<endl;
		 long long Sol;
		if(OK1L)Sol=S1L;
		if(OK1R)Sol=S1R;
		if(OK2L)Sol=S2L;
		if(OK2R)Sol=S2R;
		if(OK3L)Sol=S3L;
		if(OK3R)Sol=S3R;
		if(OK4L)Sol=S4L;
		if(OK4R)Sol=S4R;
		if(OK1L)Sol=min(Sol,S1L);
		if(OK1R)Sol=min(Sol,S1R);
		if(OK2L)Sol=min(Sol,S2L);
		if(OK2R)Sol=min(Sol,S2R);
		if(OK3L)Sol=min(Sol,S3L);
		if(OK3R)Sol=min(Sol,S3R);
		if(OK4L)Sol=min(Sol,S4L);
		if(OK4R)Sol=min(Sol,S4R);
		cout <<Sol<<endl;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define MAX -1
vector < long long> stairs,elevators;
 long long FindClosestStairsL( long long searchFor){
	 long long index=distance(stairs.begin(),lower_bound(stairs.begin(),stairs.end(),searchFor));
	if(index==stairs.size()){
		if(index==0)return MAX;
		return stairs[index-1];
	}
	 //long long R=stairs[index];
	if(index==0)return MAX;
	 long long L=stairs[index-1];

	return L;
}
 long long FindClosestStairsR( long long searchFor){
	 long long index=distance(stairs.begin(),lower_bound(stairs.begin(),stairs.end(),searchFor));
	if(index==stairs.size()){
		if(index==0)return MAX;
		return  MAX;
	}
	 long long R=stairs[index];

	 //long long L=stairs[index-1];

	return R;
}

 long long FindClosestElevatorR( long long searchFor){
	 long long index=distance(elevators.begin(),lower_bound(elevators.begin(),elevators.end(),searchFor));
	if(index==elevators.size()){
		if(index==0)return MAX;
		return MAX;
	}
	 long long R=elevators[index];
	if(index==0)return R;

	return R;

}

 long long FindClosestElevatorL( long long searchFor){
	 long long index=distance(elevators.begin(),lower_bound(elevators.begin(),elevators.end(),searchFor));
	if(index==elevators.size()){
		if(index==0)return MAX;
		return elevators[index-1];
	}
	 long long R=elevators[index];
	if(index==0)return MAX;
	 long long L=elevators[index-1];

	return L;
}

inline  long long mceil2( long long a, long long b){
	return a/b+(a%b>0);
}
int main(){
	ios_base::sync_with_stdio(false);
	 long long n,m,c1,c2,v;
	cin >>n>>m>>c1>>c2>>v;
	stairs.resize(c1);
	elevators.resize(c2);
	for( long long i=0;i<c1;i++){
		cin >>stairs[i];
	}
	for( long long i=0;i<c2;i++){
		cin >>elevators[i];
	}

	 long long q;
	cin >>q;
	for( long long qveri=0;qveri<q;qveri++){

		 long long x1,y1,x2,y2;
		cin >>y1>>x1>>y2>>x2;
		 long long e1L=FindClosestElevatorL(x1);
		 long long e1R=FindClosestElevatorR(x1);

		 long long s1L=FindClosestStairsL(x1);
 		 long long s1R=FindClosestStairsR(x1);

		 long long e2L=FindClosestElevatorL(x2);
		 long long e2R=FindClosestElevatorR(x2);

		 long long s2L=FindClosestStairsL(x2);
		 long long s2R=FindClosestStairsR(x2);
		//cout <<"ELEVATOR 1,2: "<<e1<<" "<<e2<<endl;
	 	long long S1L,S1R,S2L,S2R,S3L,S3R,S4L,S4R;
		bool OK1L,OK1R,OK2L,OK2R,OK3L,OK3R,OK4L,OK4R;
		OK1L=s1L>=0;
		OK1R=s1R>=0;
		OK2L=s2L>=0;
		OK2R=s2R>=0;

		OK3L=e1L>=0;
		OK3R=e1R>=0;
		OK4L=e2L>=0;

		OK4R=e2R>=0;
		S1L=abs(x1-s1L)+abs(y1-y2)+abs(x2-s1L);
		S1R=abs(x1-s1R)+abs(y1-y2)+abs(x2-s1R);
		S2L=abs(x1-s2L)+abs(y1-y2)+abs(x2-s2L);
		S2R=abs(x1-s2R)+abs(y1-y2)+abs(x2-s2R);

		S3L=abs(x1-e1L)+abs(x2-e1L)+mceil2(abs(y1-y2),v);
		S3R=abs(x1-e1R)+abs(x2-e1R)+mceil2(abs(y1-y2),v);
		S4L=abs(x1-e2L)+abs(x2-e2L)+mceil2(abs(y1-y2),v);
		S4R=abs(x1-e2R)+abs(x2-e2R)+mceil2(abs(y1-y2),v);
		//cout <<"S3="<<abs(x1-e1)<<"+"<<abs(x2-e1)<<"+"<<mceil2(abs(y1-y2),v)<<endl;
		//cout <<"S1: "<<S1<<endl;
		//cout <<"S2: "<<S2<<endl;
		//cout <<"S3(E1): "<<S3<<endl;
		//cout <<"S4(E2): "<<S4<<endl;
		 long long Sol;
		if(OK1L)Sol=S1L;
		if(OK1R)Sol=S1R;
		if(OK2L)Sol=S2L;
		if(OK2R)Sol=S2R;
		if(OK3L)Sol=S3L;
		if(OK3R)Sol=S3R;
		if(OK4L)Sol=S4L;
		if(OK4R)Sol=S4R;
		if(OK1L)Sol=min(Sol,S1L);
		if(OK1R)Sol=min(Sol,S1R);
		if(OK2L)Sol=min(Sol,S2L);
		if(OK2R)Sol=min(Sol,S2R);
		if(OK3L)Sol=min(Sol,S3L);
		if(OK3R)Sol=min(Sol,S3R);
		if(OK4L)Sol=min(Sol,S4L);
		if(OK4R)Sol=min(Sol,S4R);
		cout <<Sol<<endl;
	}
	//HAHAHA
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define MAX pow(10.0f,9)
int FindClosest(vector<int> x,int searchFor){
	int index=distance(x.begin(),lower_bound(x.begin(),x.end(),searchFor));
	if(index==x.size()){
		if(index==0)return MAX;
		return x[index-1];
	}
	int R=x[index];
	if(index==0)return R;
	int L=x[index-1];

	if(abs(searchFor-L)>abs(searchFor-R))return R;
	return L;
}
int mceil2(int a,int b){
	return a/b+(a%b>0);
}
int main(){
	int n,m,c1,c2,v;
	cin >>n>>m>>c1>>c2>>v;
	vector <int> stairs(c1),elevators(c2);
	for(int i=0;i<c1;i++){
		cin >>stairs[i];
	}
	for(int i=0;i<c2;i++){
		cin >>elevators[i];
	}
	int q;
	cin >>q;
	for(int qveri=0;qveri<q;qveri++){

		int x1,y1,x2,y2;
		cin >>y1>>x1>>y2>>x2;
		int e1=FindClosest(elevators,x1);
		int s1=FindClosest(stairs,x1);
		int e2=FindClosest(elevators,x2);
		int s2=FindClosest(stairs,x2);
		//cout <<"ELEVATOR 1,2: "<<e1<<" "<<e2<<endl;
		int S1,S2,S3,S4;
		S1=abs(x1-s1)+abs(y1-y2)+abs(x2-s1);
		S2=abs(x1-s2)+abs(y1-y2)+abs(x2-s2);

		S3=abs(x1-e1)+abs(x2-e1)+mceil2(abs(y1-y2),v);
		S4=abs(x1-e2)+abs(x2-e2)+mceil2(abs(y1-y2),v);
		//cout <<"S3="<<abs(x1-e1)<<"+"<<abs(x2-e1)<<"+"<<mceil2(abs(y1-y2),v)<<endl;
		//cout <<"S1: "<<S1<<endl;
		//cout <<"S2: "<<S2<<endl;
		//cout <<"S3(E1): "<<S3<<endl;
		//cout <<"S4(E2): "<<S4<<endl;
		cout <<min(S1,min(S2,min(S3,S4)))<<endl;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define MAX pow(10.0f,9)
vector <int> stairs,elevators;
int FindClosestStairs(int searchFor){
	int index=distance(stairs.begin(),lower_bound(stairs.begin(),stairs.end(),searchFor));
	if(index==stairs.size()){
		if(index==0)return MAX;
		return stairs[index-1];
	}
	int R=stairs[index];
	if(index==0)return R;
	int L=stairs[index-1];

	if(abs(searchFor-L)>abs(searchFor-R))return R;
	return L;
}
int FindClosestElevator(int searchFor){
	int index=distance(elevators.begin(),lower_bound(elevators.begin(),elevators.end(),searchFor));
	if(index==elevators.size()){
		if(index==0)return MAX;
		return elevators[index-1];
	}
	int R=elevators[index];
	if(index==0)return R;
	int L=elevators[index-1];

	if(abs(searchFor-L)>abs(searchFor-R))return R;
	return L;
}
inline int mceil2(int a,int b){
	return a/b+(a%b>0);
}
int main(){
	ios_base::sync_with_stdio(false);
	int n,m,c1,c2,v;
	cin >>n>>m>>c1>>c2>>v;
	stairs.resize(c1);
	elevators.resize(c2);
	for(int i=0;i<c1;i++){
		cin >>stairs[i];
	}
	for(int i=0;i<c2;i++){
		cin >>elevators[i];
	}

	int q;
	cin >>q;
	for(int qveri=0;qveri<q;qveri++){

		int x1,y1,x2,y2;
		cin >>y1>>x1>>y2>>x2;
		int e1=FindClosestElevator(x1);
		int s1=FindClosestStairs(x1);
		int e2=FindClosestElevator(x2);
		int s2=FindClosestStairs(x2);
		//cout <<"ELEVATOR 1,2: "<<e1<<" "<<e2<<endl;
		int S1,S2,S3,S4;
		S1=abs(x1-s1)+abs(y1-y2)+abs(x2-s1);
		S2=abs(x1-s2)+abs(y1-y2)+abs(x2-s2);

		S3=abs(x1-e1)+abs(x2-e1)+mceil2(abs(y1-y2),v);
		S4=abs(x1-e2)+abs(x2-e2)+mceil2(abs(y1-y2),v);
		//cout <<"S3="<<abs(x1-e1)<<"+"<<abs(x2-e1)<<"+"<<mceil2(abs(y1-y2),v)<<endl;
		//cout <<"S1: "<<S1<<endl;
		//cout <<"S2: "<<S2<<endl;
		//cout <<"S3(E1): "<<S3<<endl;
		//cout <<"S4(E2): "<<S4<<endl;
		cout <<min(S1,min(S2,min(S3,S4)))<<endl;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define MAX -1
vector < long long> stairs,elevators;
 long long FindClosestStairsL( long long searchFor){
	 long long index=distance(stairs.begin(),lower_bound(stairs.begin(),stairs.end(),searchFor));
	if(index==stairs.size()){
		if(index==0)return MAX;
		return stairs[index-1];
	}
	 //long long R=stairs[index];
	if(index==0)return MAX;
	 long long L=stairs[index-1];

	return L;
}
 long long FindClosestStairsR( long long searchFor){
	 long long index=distance(stairs.begin(),lower_bound(stairs.begin(),stairs.end(),searchFor));
	if(index==stairs.size()){
		if(index==0)return MAX;
		return  MAX;
	}
	 long long R=stairs[index];

	 //long long L=stairs[index-1];

	return R;
}

 long long FindClosestElevatorR( long long searchFor){
	 long long index=distance(elevators.begin(),lower_bound(elevators.begin(),elevators.end(),searchFor));
	if(index==elevators.size()){
		if(index==0)return MAX;
		return MAX;
	}
	 long long R=elevators[index];
	if(index==0)return R;

	return R;

}

 long long FindClosestElevatorL( long long searchFor){
	 long long index=distance(elevators.begin(),lower_bound(elevators.begin(),elevators.end(),searchFor));
	if(index==elevators.size()){
		if(index==0)return MAX;
		return elevators[index-1];
	}
	 long long R=elevators[index];
	if(index==0)return MAX;
	 long long L=elevators[index-1];

	return L;
}

inline  long long mceil2( long long a, long long b){
	return a/b+(a%b>0);
}
int main(){
	ios_base::sync_with_stdio(false);
	 long long n,m,c1,c2,v;
	cin >>n>>m>>c1>>c2>>v;
	stairs.resize(c1);
	elevators.resize(c2);
	for( long long i=0;i<c1;i++){
		cin >>stairs[i];
	}
	for( long long i=0;i<c2;i++){
		cin >>elevators[i];
	}

	 long long q;
	cin >>q;
	for( long long qveri=0;qveri<q;qveri++){

		 long long x1,y1,x2,y2;
		cin >>y1>>x1>>y2>>x2;
		if(y1==y2){
			cout <<abs(x1-x2)<<endl;
			continue;
		}
		 long long e1L=FindClosestElevatorL(x1);
		 long long e1R=FindClosestElevatorR(x1);

		 long long s1L=FindClosestStairsL(x1);
 		 long long s1R=FindClosestStairsR(x1);

		 long long e2L=FindClosestElevatorL(x2);
		 long long e2R=FindClosestElevatorR(x2);

		 long long s2L=FindClosestStairsL(x2);
		 long long s2R=FindClosestStairsR(x2);
		//cout <<"ELEVATOR 1,2: "<<e1<<" "<<e2<<endl;
	 	long long S1L,S1R,S2L,S2R,S3L,S3R,S4L,S4R;
		bool OK1L,OK1R,OK2L,OK2R,OK3L,OK3R,OK4L,OK4R;
		OK1L=s1L>=0;
		OK1R=s1R>=0;
		OK2L=s2L>=0;
		OK2R=s2R>=0;

		OK3L=e1L>=0;
		OK3R=e1R>=0;
		OK4L=e2L>=0;

		OK4R=e2R>=0;
		S1L=abs(x1-s1L)+abs(y1-y2)+abs(x2-s1L);
		S1R=abs(x1-s1R)+abs(y1-y2)+abs(x2-s1R);
		S2L=abs(x1-s2L)+abs(y1-y2)+abs(x2-s2L);
		S2R=abs(x1-s2R)+abs(y1-y2)+abs(x2-s2R);

		S3L=abs(x1-e1L)+abs(x2-e1L)+mceil2(abs(y1-y2),v);
		S3R=abs(x1-e1R)+abs(x2-e1R)+mceil2(abs(y1-y2),v);
		S4L=abs(x1-e2L)+abs(x2-e2L)+mceil2(abs(y1-y2),v);
		S4R=abs(x1-e2R)+abs(x2-e2R)+mceil2(abs(y1-y2),v);
		//cout <<"S3="<<abs(x1-e1)<<"+"<<abs(x2-e1)<<"+"<<mceil2(abs(y1-y2),v)<<endl;
		//cout <<"S1: "<<S1<<endl;
		//cout <<"S2: "<<S2<<endl;
		//cout <<"S3(E1): "<<S3<<endl;
		//cout <<"S4(E2): "<<S4<<endl;
		 long long Sol;
		if(OK1L)Sol=S1L;
		if(OK1R)Sol=S1R;
		if(OK2L)Sol=S2L;
		if(OK2R)Sol=S2R;
		if(OK3L)Sol=S3L;
		if(OK3R)Sol=S3R;
		if(OK4L)Sol=S4L;
		if(OK4R)Sol=S4R;
		if(OK1L)Sol=min(Sol,S1L);
		if(OK1R)Sol=min(Sol,S1R);
		if(OK2L)Sol=min(Sol,S2L);
		if(OK2R)Sol=min(Sol,S2R);
		if(OK3L)Sol=min(Sol,S3L);
		if(OK3R)Sol=min(Sol,S3R);
		if(OK4L)Sol=min(Sol,S4L);
		if(OK4R)Sol=min(Sol,S4R);
		cout <<Sol<<endl;
	}
	//HAHAHA
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define MAX pow(10.0f,9)
int FindClosest(vector<int> x,int searchFor){
	int index=distance(x.begin(),lower_bound(x.begin(),x.end(),searchFor));
	if(index==x.size()){
		if(index==0)return MAX;
		return x[index-1];
	}
	int R=x[index];
	if(index==0)return R;
	int L=x[index-1];

	if(abs(searchFor-L)>abs(searchFor-R))return R;
	return L;
}
int mceil2(int a,int b){
	return a/b+(a%b>0);
}
int main(){
	ios_base::sync_with_stdio(false);
	int n,m,c1,c2,v;
	cin >>n>>m>>c1>>c2>>v;
	vector <int> stairs(c1),elevators(c2);
	for(int i=0;i<c1;i++){
		cin >>stairs[i];
	}
	for(int i=0;i<c2;i++){
		cin >>elevators[i];
	}

	int q;
	cin >>q;
	for(int qveri=0;qveri<q;qveri++){

		int x1,y1,x2,y2;
		cin >>y1>>x1>>y2>>x2;
		int e1=FindClosest(elevators,x1);
		int s1=FindClosest(stairs,x1);
		int e2=FindClosest(elevators,x2);
		int s2=FindClosest(stairs,x2);
		//cout <<"ELEVATOR 1,2: "<<e1<<" "<<e2<<endl;
		int S1,S2,S3,S4;
		S1=abs(x1-s1)+abs(y1-y2)+abs(x2-s1);
		S2=abs(x1-s2)+abs(y1-y2)+abs(x2-s2);

		S3=abs(x1-e1)+abs(x2-e1)+mceil2(abs(y1-y2),v);
		S4=abs(x1-e2)+abs(x2-e2)+mceil2(abs(y1-y2),v);
		//cout <<"S3="<<abs(x1-e1)<<"+"<<abs(x2-e1)<<"+"<<mceil2(abs(y1-y2),v)<<endl;
		//cout <<"S1: "<<S1<<endl;
		//cout <<"S2: "<<S2<<endl;
		//cout <<"S3(E1): "<<S3<<endl;
		//cout <<"S4(E2): "<<S4<<endl;
		cout <<min(S1,min(S2,min(S3,S4)))<<endl;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define MAX pow(10.0f,10)
int FindClosest(vector<int> x,int searchFor){
	int index=distance(x.begin(),lower_bound(x.begin(),x.end(),searchFor));
	if(index==x.size()){
		if(index==0)return MAX;
		return x[index-1];
	}
	int R=x[index];
	if(index==0)return R;
	int L=x[index-1];

	if(abs(searchFor-L)>abs(searchFor-R))return R;
	return L;
}
int mceil2(int a,int b){
	return a/b+(a%b>0);
}
int main(){
	int n,m,c1,c2,v;
	cin >>n>>m>>c1>>c2>>v;
	vector <int> stairs(c1),elevators(c2);
	for(int i=0;i<c1;i++){
		cin >>stairs[i];
	}
	for(int i=0;i<c2;i++){
		cin >>elevators[i];
	}
	int q;
	cin >>q;
	for(int qveri=0;qveri<q;qveri++){

		int x1,y1,x2,y2;
		cin >>y1>>x1>>y2>>x2;
		int e1=FindClosest(elevators,x1);
		int s1=FindClosest(stairs,x1);
		int e2=FindClosest(elevators,x2);
		int s2=FindClosest(stairs,x2);
		//cout <<"ELEVATOR 1,2: "<<e1<<" "<<e2<<endl;
		int S1,S2,S3,S4;
		S1=abs(x1-s1)+abs(y1-y2)+abs(x2-s1);
		S2=abs(x1-s2)+abs(y1-y2)+abs(x2-s2);

		S3=abs(x1-e1)+abs(x2-e1)+mceil2(abs(y1-y2),v);
		S4=abs(x1-e2)+abs(x2-e2)+mceil2(abs(y1-y2),v);
		//cout <<"S3="<<abs(x1-e1)<<"+"<<abs(x2-e1)<<"+"<<mceil2(abs(y1-y2),v)<<endl;
		//cout <<"S1: "<<S1<<endl;
		//cout <<"S2: "<<S2<<endl;
		//cout <<"S3(E1): "<<S3<<endl;
		//cout <<"S4(E2): "<<S4<<endl;
		cout <<min(S1,min(S2,min(S3,S4)))<<endl;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int FindClosest(vector<int> x,int searchFor){
	int index=distance(x.begin(),lower_bound(x.begin(),x.end(),searchFor));
	if(index==x.size()){
		return x[index-1];
	}
	int R=x[index];
	if(index==0)return R;
	int L=x[index-1];

	if(abs(searchFor-L)>abs(searchFor-R))return R;
	return L;
}
int mceil2(int a,int b){
	return a/b+(a%b>0);
}
int main(){
	int n,m,c1,c2,v;
	cin >>n>>m>>c1>>c2>>v;
	vector <int> stairs(c1),elevators(c2);
	for(int i=0;i<c1;i++){
		cin >>stairs[i];
	}
	for(int i=0;i<c2;i++){
		cin >>elevators[i];
	}
	int q;
	cin >>q;
	for(int qveri=0;qveri<q;qveri++){

		int x1,y1,x2,y2;
		cin >>y1>>x1>>y2>>x2;
		int e1=FindClosest(elevators,x1);
		int s1=FindClosest(stairs,x1);
		int e2=FindClosest(elevators,x2);
		int s2=FindClosest(stairs,x2);
		//cout <<"ELEVATOR 1,2: "<<e1<<" "<<e2<<endl;
		int S1,S2,S3,S4;
		S1=abs(x1-s1)+abs(y1-y2)+abs(x2-s1);
		S2=abs(x1-s2)+abs(y1-y2)+abs(x2-s2);

		S3=abs(x1-e1)+abs(x2-e1)+mceil2(abs(y1-y2),v);
		S4=abs(x1-e2)+abs(x2-e2)+mceil2(abs(y1-y2),v);
		//cout <<"S3="<<abs(x1-e1)<<"+"<<abs(x2-e1)<<"+"<<mceil2(abs(y1-y2),v)<<endl;
		//cout <<"S1: "<<S1<<endl;
		//cout <<"S2: "<<S2<<endl;
		//cout <<"S3(E1): "<<S3<<endl;
		//cout <<"S4(E2): "<<S4<<endl;
		cout <<min(S1,min(S2,min(S3,S4)))<<endl;
	}
}


#include <bits/stdc++.h>
const int INF = ~0U>>1;
using namespace std;
int n, m, cl, ce, v, qs, q;
long long E[100005], S[100005];
int findstair(int val) {
	int left = 0, right = cl, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == S[mid]) {
			return mid;
		}
		else if(val > S[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int findelevator(int val) {
	int left = 0, right = ce, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == E[mid]) {
			return mid;
		}
		else if(val > E[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int main(){
	scanf("%d%d%d%d%d", &n, &m, &cl, &ce, &v);
	for(int i = 1; i <= cl; ++i) {
		cin >> S[i];
	}
	for(int i = 1; i <= ce; ++i) {
		cin >> E[i];
	}
	scanf("%d", &q);
	for(int i = 1; i <= q; ++i) {
		long long ans = 10000000000;
		int x1, y1, x2, y2;
		scanf("%d%d%d%d", &y1, &x1, &y2, &x2);
		int st = findstair(x1);
		if(st - 1 > 0 && st - 1 <= cl && S[st - 1] != 0) {
			ans = min(ans, abs(x1 - S[st - 1]) + abs(x2 - S[st - 1]) + abs(y2 - y1));
		}
		if(st > 0 && st <= cl && S[st] != 0) {
			ans = min(ans, abs(x1 - S[st]) + abs(x2 - S[st]) + abs(y2 - y1));
		}
		if(st + 1 > 0 && st + 1 <= cl && S[st + 1] != 0) {
			ans = min(ans, abs(x1 - S[st + 1]) + abs(x2 - S[st + 1]) + abs(y2 - y1));
		}
		st = findstair(x2);
		if(st - 1 > 0 && st - 1 <= cl && S[st - 1] != 0) {
			ans = min(ans, abs(x1 - S[st - 1]) + abs(x2 - S[st - 1]) + abs(y2 - y1));
		}
		if(st > 0 && st <= cl && S[st] != 0) {
			ans = min(ans, abs(x1 - S[st]) + abs(x2 - S[st]) + abs(y2 - y1));
		}
		if(st + 1 > 0 && st + 1 <= cl && S[st + 1] != 0) {
			ans = min(ans, abs(x1 - S[st + 1]) + abs(x2 - S[st + 1]) + abs(y2 - y1));
		}
		int el = findelevator(x1);
		if(el - 1 > 0 && el - 1 <= ce && E[el - 1] != 0) {
			ans = min(ans, abs(x1 - E[el - 1]) + abs(x2 - E[el - 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el > 0 && el <= ce && E[el] != 0) {
			ans = min(ans, abs(x1 - E[el]) + abs(x2 - E[el]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el + 1 > 0 && el + 1 <= ce && E[el + 1] != 0) {
			ans = min(ans, abs(x1 - E[el + 1]) + abs(x2 - E[el + 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		el = findelevator(x2);
		if(el - 1 > 0 && el - 1 <= ce && E[el - 1] != 0) {
			ans = min(ans, abs(x1 - E[el - 1]) + abs(x2 - E[el - 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el > 0 && el <= ce && E[el] != 0) {
			ans = min(ans, abs(x1 - E[el]) + abs(x2 - E[el]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el + 1 > 0 && el + 1 <= ce && E[el + 1] != 0) {
			ans = min(ans, abs(x1 - E[el + 1]) + abs(x2 - E[el + 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		cout << ans << endl;
	}
return 0;
}


#include <bits/stdc++.h>
const int INF = ~0U>>1;
using namespace std;
int n, m, cl, ce, v, qs, q;
long long E[100005], S[100005];
int findstair(int val) {
	int left = 1, right = cl, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == S[mid]) {
			return mid;
		}
		else if(val > S[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int findelevator(int val) {
	int left = 1, right = ce, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == E[mid]) {
			return mid;
		}
		else if(val > E[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int main(){
	scanf("%d%d%d%d%d", &n, &m, &cl, &ce, &v);
	for(int i = 1; i <= cl; ++i) {
		cin >> S[i];
	}
	for(int i = 1; i <= ce; ++i) {
		cin >> E[i];
	}
	scanf("%d", &q);
	for(int i = 1; i <= q; ++i) {
		long long ans = INF;
		int x1, y1, x2, y2;
		scanf("%d%d%d%d", &y1, &x1, &y2, &x2);
		int st = findstair(x1);
		if(st - 1 > 0 && st - 1 <= cl && S[st - 1] != 0) {
			ans = min(ans, abs(x1 - S[st - 1]) + abs(x2 - S[st - 1]) + abs(y2 - y1));
		}
		if(st > 0 && st <= cl && S[st] != 0) {
			ans = min(ans, abs(x1 - S[st]) + abs(x2 - S[st]) + abs(y2 - y1));
		}
		if(st + 1 > 0 && st + 1 <= cl && S[st + 1] != 0) {
			ans = min(ans, abs(x1 - S[st + 1]) + abs(x2 - S[st + 1]) + abs(y2 - y1));
		}
		st = findstair(x2);
		if(st - 1 > 0 && st - 1 <= cl && S[st - 1] != 0) {
			ans = min(ans, abs(x1 - S[st - 1]) + abs(x2 - S[st - 1]) + abs(y2 - y1));
		}
		if(st > 0 && st <= cl && S[st] != 0) {
			ans = min(ans, abs(x1 - S[st]) + abs(x2 - S[st]) + abs(y2 - y1));
		}
		if(st + 1 > 0 && st + 1 <= cl && S[st + 1] != 0) {
			ans = min(ans, abs(x1 - S[st + 1]) + abs(x2 - S[st + 1]) + abs(y2 - y1));
		}
		int el = findelevator(x1);
		if(el - 1 > 0 && el - 1 <= ce && E[el - 1] != 0) {
			ans = min(ans, abs(x1 - E[el - 1]) + abs(x2 - E[el - 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el > 0 && el <= ce && E[el] != 0) {
			ans = min(ans, abs(x1 - E[el]) + abs(x2 - E[el]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el + 1 > 0 && el + 1 <= ce && E[el + 1] != 0) {
			ans = min(ans, abs(x1 - E[el + 1]) + abs(x2 - E[el + 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		el = findelevator(x2);
		if(el - 1 > 0 && el - 1 <= ce && E[el - 1] != 0) {
			ans = min(ans, abs(x1 - E[el - 1]) + abs(x2 - E[el - 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el > 0 && el <= ce && E[el] != 0) {
			ans = min(ans, abs(x1 - E[el]) + abs(x2 - E[el]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el + 1 > 0 && el + 1 <= ce && E[el + 1] != 0) {
			ans = min(ans, abs(x1 - E[el + 1]) + abs(x2 - E[el + 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		cout << ans << endl;
	}
return 0;
}


#include <bits/stdc++.h>
const int INF = ~0U>>1;
using namespace std;
int n, m, cl, ce, v, qs, q;
long long E[100005], S[100005];
int findstair(int val) {
	int left = 1, right = cl, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == S[mid]) {
			return mid;
		}
		else if(val > S[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int findelevator(int val) {
	int left = 1, right = ce, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == E[mid]) {
			return mid;
		}
		else if(val > E[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int main(){
	scanf("%d%d%d%d%d", &n, &m, &cl, &ce, &v);
	for(int i = 1; i <= cl; ++i) {
		cin >> S[i];
	}
	for(int i = 1; i <= ce; ++i) {
		cin >> E[i];
	}
	scanf("%d", &q);
	for(int i = 1; i <= q; ++i) {
		long long ans = INF;
		int x1, y1, x2, y2;
		scanf("%d%d%d%d", &y1, &x1, &y2, &x2);
		if(y1 == y2) {
			printf("%d\n", abs(x1 - x2));
			continue;
		}
		int st = findstair(x1);
		if(st - 1 > 0 && st - 1 <= cl && S[st - 1] != 0) {
			ans = min(ans, abs(x1 - S[st - 1]) + abs(x2 - S[st - 1]) + abs(y2 - y1));
		}
		if(st > 0 && st <= cl && S[st] != 0) {
			ans = min(ans, abs(x1 - S[st]) + abs(x2 - S[st]) + abs(y2 - y1));
		}
		if(st + 1 > 0 && st + 1 <= cl && S[st + 1] != 0) {
			ans = min(ans, abs(x1 - S[st + 1]) + abs(x2 - S[st + 1]) + abs(y2 - y1));
		}
		int el = findelevator(x1);
		if(el - 1 > 0 && el - 1 <= ce && E[el - 1] != 0) {
			ans = min(ans, abs(x1 - E[el - 1]) + abs(x2 - E[el - 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el > 0 && el <= ce && E[el] != 0) {
			ans = min(ans, abs(x1 - E[el]) + abs(x2 - E[el]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el + 1 > 0 && el + 1 <= ce && E[el + 1] != 0) {
			ans = min(ans, abs(x1 - E[el + 1]) + abs(x2 - E[el + 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		cout << ans << endl;
	}
return 0;
}


#include <bits/stdc++.h>
const int INF = ~0U>>1;
using namespace std;
int n, m, cl, ce, v, qs, q;
long long E[100005], S[100005];
int findstair(int val) {
	int left = 1, right = cl, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == S[mid]) {
			return mid;
		}
		else if(val > S[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int findelevator(int val) {
	int left = 1, right = ce, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == E[mid]) {
			return mid;
		}
		else if(val > E[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int main(){
	scanf("%d%d%d%d%d", &n, &m, &cl, &ce, &v);
	for(int i = 1; i <= cl; ++i) {
		cin >> S[i];
	}
	for(int i = 1; i <= ce; ++i) {
		cin >> E[i];
	}
	scanf("%d", &q);
	for(int i = 1; i <= q; ++i) {
		long long ans = INF;
		int x1, y1, x2, y2;
		scanf("%d%d%d%d", &y1, &x1, &y2, &x2);
		if(y1 == y2) {
			printf("%d\n", abs(x1 - x2));
			continue;
		}
		int st = findstair(x1);
		if(st - 1 > 0 && st - 1 <= cl && S[st - 1] != 0) {
			ans = min(ans, abs(x1 - S[st - 1]) + abs(x2 - S[st - 1]) + abs(y2 - y1));
		}
		if(st > 0 && st <= cl && S[st] != 0) {
			ans = min(ans, abs(x1 - S[st]) + abs(x2 - S[st]) + abs(y2 - y1));
		}
		if(st + 1 > 0 && st + 1 <= cl && S[st + 1] != 0) {
			ans = min(ans, abs(x1 - S[st + 1]) + abs(x2 - S[st + 1]) + abs(y2 - y1));
		}
		st = findstair(x2);
		if(st - 1 > 0 && st - 1 <= cl && S[st - 1] != 0) {
			ans = min(ans, abs(x1 - S[st - 1]) + abs(x2 - S[st - 1]) + abs(y2 - y1));
		}
		if(st > 0 && st <= cl && S[st] != 0) {
			ans = min(ans, abs(x1 - S[st]) + abs(x2 - S[st]) + abs(y2 - y1));
		}
		if(st + 1 > 0 && st + 1 <= cl && S[st + 1] != 0) {
			ans = min(ans, abs(x1 - S[st + 1]) + abs(x2 - S[st + 1]) + abs(y2 - y1));
		}
		int el = findelevator(x1);
		if(el - 1 > 0 && el - 1 <= ce && E[el - 1] != 0) {
			ans = min(ans, abs(x1 - E[el - 1]) + abs(x2 - E[el - 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el > 0 && el <= ce && E[el] != 0) {
			ans = min(ans, abs(x1 - E[el]) + abs(x2 - E[el]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el + 1 > 0 && el + 1 <= ce && E[el + 1] != 0) {
			ans = min(ans, abs(x1 - E[el + 1]) + abs(x2 - E[el + 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		el = findelevator(x2);
		if(el - 1 > 0 && el - 1 <= ce && E[el - 1] != 0) {
			ans = min(ans, abs(x1 - E[el - 1]) + abs(x2 - E[el - 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el > 0 && el <= ce && E[el] != 0) {
			ans = min(ans, abs(x1 - E[el]) + abs(x2 - E[el]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el + 1 > 0 && el + 1 <= ce && E[el + 1] != 0) {
			ans = min(ans, abs(x1 - E[el + 1]) + abs(x2 - E[el + 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		cout << ans << endl;
	}
return 0;
}


#include <bits/stdc++.h>
const int INF = ~0U>>1;
using namespace std;
int n, m, cl, ce, v, qs, q;
int E[100005], S[100005];
int findstair(int val) {
	int left = 0, right = cl, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == S[mid]) {
			return mid;
		}
		else if(val > S[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int findelevator(int val) {
	int left = 0, right = ce, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == E[mid]) {
			return mid;
		}
		else if(val > E[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int main(){
	scanf("%d%d%d%d%d", &n, &m, &cl, &ce, &v);
	for(int i = 1; i <= cl; ++i) {
		scanf("%d", &S[i]);
	}
	for(int i = 1; i <= ce; ++i) {
		scanf("%d", &E[i]);
	}
	scanf("%d", &q);
	for(int i = 1; i <= q; ++i) {
		int ans = INF;
		int x1, y1, x2, y2;
		scanf("%d%d%d%d", &y1, &x1, &y2, &x2);
		int st = findstair(x1);
		if(st - 1 > 0 && st - 1 <= cl && S[st - 1] != 0) {
			ans = min(ans, abs(x1 - S[st - 1]) + abs(x2 - S[st - 1]) + abs(y2 - y1));
		}
		if(st > 0 && st <= cl && S[st] != 0) {
			ans = min(ans, abs(x1 - S[st]) + abs(x2 - S[st]) + abs(y2 - y1));
		}
		if(st + 1 > 0 && st + 1 <= cl && S[st + 1] != 0) {
			ans = min(ans, abs(x1 - S[st + 1]) + abs(x2 - S[st + 1]) + abs(y2 - y1));
		}
		int el = findelevator(x1);
		if(el - 1 > 0 && el - 1 <= ce && E[el - 1] != 0) {
			ans = min(ans, abs(x1 - E[el - 1]) + abs(x2 - E[el - 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el > 0 && el <= ce && E[el] != 0) {
			ans = min(ans, abs(x1 - E[el]) + abs(x2 - E[el]) + (abs(y2 - y1) - 1) / v + 1);
			cout << abs(x1 - E[el]) << ' ' <<  abs(x2 - E[el]) << ' ' << (abs(y2 - y1) - 1) / v + 1 << endl;
		}
		if(el + 1 > 0 && el + 1 <= ce && E[el + 1] != 0) {
			ans = min(ans, abs(x1 - E[el + 1]) + abs(x2 - E[el + 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		printf("%d\n", ans);
	}
return 0;
}


#include <bits/stdc++.h>
const int INF = ~0U>>1;
using namespace std;
int n, m, cl, ce, v, qs, q;
int E[100005], S[100005];
int findstair(int val) {
	int left = 0, right = cl, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == S[mid]) {
			return mid;
		}
		else if(val > S[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int findelevator(int val) {
	int left = 0, right = ce, mid;
	while(left <= right) {
		mid = (left + right) >> 1;
		if(val == E[mid]) {
			return mid;
		}
		else if(val > E[mid]) {
			left = mid + 1;
		}
		else right = mid - 1;
	}
	return mid;
}
int main(){
	scanf("%d%d%d%d%d", &n, &m, &cl, &ce, &v);
	for(int i = 1; i <= cl; ++i) {
		scanf("%d", &S[i]);
	}
	for(int i = 1; i <= ce; ++i) {
		scanf("%d", &E[i]);
	}
	scanf("%d", &q);
	for(int i = 1; i <= q; ++i) {
		int ans = INF;
		int x1, y1, x2, y2;
		scanf("%d%d%d%d", &y1, &x1, &y2, &x2);
		int st = findstair(x1);
		if(st - 1 > 0 && st - 1 <= cl && S[st - 1] != 0) {
			ans = min(ans, abs(x1 - S[st - 1]) + abs(x2 - S[st - 1]) + abs(y2 - y1));
		}
		if(st > 0 && st <= cl && S[st] != 0) {
			ans = min(ans, abs(x1 - S[st]) + abs(x2 - S[st]) + abs(y2 - y1));
		}
		if(st + 1 > 0 && st + 1 <= cl && S[st + 1] != 0) {
			ans = min(ans, abs(x1 - S[st + 1]) + abs(x2 - S[st + 1]) + abs(y2 - y1));
		}
		int el = findelevator(x1);
		if(el - 1 > 0 && el - 1 <= ce && E[el - 1] != 0) {
			ans = min(ans, abs(x1 - E[el - 1]) + abs(x2 - E[el - 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el > 0 && el <= ce && E[el] != 0) {
			ans = min(ans, abs(x1 - E[el]) + abs(x2 - E[el]) + (abs(y2 - y1) - 1) / v + 1);
		}
		if(el + 1 > 0 && el + 1 <= ce && E[el + 1] != 0) {
			ans = min(ans, abs(x1 - E[el + 1]) + abs(x2 - E[el + 1]) + (abs(y2 - y1) - 1) / v + 1);
		}
		printf("%d\n", ans);
	}
return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3fffffff
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	stair[cl+1]=INF;
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	elevator[ce+1]=INF;
	sort(stair+1,stair+1+cl);
	sort(elevator+1,elevator+1+ce);
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int ans=INF;
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		if(xf==xt)
		{
			printf("%d\n",abs(yf-yt));
			continue;
		}
  		int l=abs(xf-xt);
		int e=(abs(xf-xt)-1)/v+1;
		if(yf>yt)swap(yf,yt);
		int j=lb(stair+1,stair+1+cl,yf)-stair;
		int k=lb(elevator+1,elevator+1+ce,yf)-elevator;
		if(j<cl&&j>0)ans=min(ans,abs(yf-stair[j])+abs(yt-stair[j])+l);
		if(j>1&&j<cl)ans=min(ans,abs(yf-stair[j-1])+abs(yt-stair[j-1])+l);
		if(k<ce&&k>0)ans=min(ans,abs(yf-elevator[k])+abs(yt-elevator[k])+e);
		if(k>1&&k<ce)ans=min(ans,abs(yf-elevator[k-1])+abs(yt-elevator[k-1])+e);
		printf("%d\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3fffffff
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	stair[cl+1]=INF;
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	elevator[ce+1]=INF;
	sort(stair+1,stair+1+cl);
	sort(elevator+1,elevator+1+ce);
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int ans=INF;
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		if(xf==xt)
		{
			printf("%d\n",abs(yf-yt));
			continue;
		}
  		int l=abs(xf-xt);
		int e=(abs(xf-xt)-1)/v+1;
		if(yf>yt)swap(yf,yt);
		int j=lb(stair+1,stair+1+cl,yf)-stair;
		int k=lb(elevator+1,elevator+1+ce,yf)-elevator;
		if(j<m&&j>0)ans=min(ans,abs(yf-stair[j])+abs(yt-stair[j])+l);
		if(j>1&&j<m)ans=min(ans,abs(yf-stair[j-1])+abs(yt-stair[j-1])+l);
		if(k<m&&k>0)ans=min(ans,abs(yf-elevator[k])+abs(yt-elevator[k])+e);
		if(k>1&&k<m)ans=min(ans,abs(yf-elevator[k-1])+abs(yt-elevator[k-1])+e);
		printf("%d\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3f3f3f3f
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int l[4],e[4];

		int l1=lower_bound(stair+1,stair+cl+1,yf)-stair;
		if(l1-1>0)l[0]=stair[l1-1];
		else l[0]=INF;

		if(cl>0)l[1]=stair[l1];
		else l[1]=INF;

		int l2=lower_bound(stair+1,stair+cl+1,yt)-stair;
		if(l2-1>0)l[2]=stair[l2-1];
		else l[2]=INF;

		if(cl>0)l[3]=stair[l2];
		else l[3]=INF;

		int e1=lower_bound(elevator+1,elevator+ce+1,yf)-elevator;
		if(e1-1>0)e[0]=elevator[e1-1];
		else e[0]=INF;

		if(ce>0)e[1]=elevator[e1];
		else e[1]=INF;

		int e2=lower_bound(elevator+1,elevator+ce+1,yt)-elevator;
		if(e2-1>0)e[2]=elevator[e2-1];
		else e[2]=INF;

		if(ce>0)e[3]=elevator[e2];
		else e[3]=INF;

		int Min1=INF,ans1=0;
		for(int i=0;i<4;i++)
		{
			if(abs(l[i]-yf)+abs(l[i]-yt)<Min1)
			{
				Min1=abs(l[i]-yf)+abs(l[i]-yt);
				ans1=l[i];
			}
		}
		int ansl=Min1+disl;

		int Min2=INF,ans2=0;
		for(int i=0;i<4;i++)
		{
			if(abs(e[i]-yf)+abs(e[i]-yt)<Min2)
			{
				Min2=abs(e[i]-yf)+abs(e[i]-yt);
				ans2=e[i];
			}
		}
		int anse=Min2+dise;
		printf("%d\n",min(ansl,anse));
	}
	return 0;
}


#include<cstdio>
#include<cctype>
#include<algorithm>
#define INF 0x7fffffff
#define N 1234567
using namespace std;
int R,C,n,m,V,Q,D[N],L[N],ans;
int Fnd_D(int x)
{
    int l=0,r=m;
    while(l<=r)
	{
        int mid=(r+l)>>1;
        if(D[mid]<=x&&x<D[mid+1])return mid;
        if(D[mid]<=x)l=mid+1;else r=mid-1;
    }
    return 0;
}
int Fnd_L(int x)
{
    int l=0,r=n;
    while(l<=r)
	{
        int mid=(r+l)>>1;
        if(L[mid]<=x&&x<L[mid+1])return mid;
        if(L[mid]<=x)l=mid+1;else r=mid-1;
    }
    return 0;
}
int main()
{
	//freopen("qc.in","r",stdin);
    scanf("%d%d%d%d%d",&R,&C,&n,&m,&V);
	D[m+1]=L[n+1]=INF;
    for(int i=1;i<=n;i++)scanf("%d",&L[i]);
    for(int i=1;i<=m;i++)scanf("%d",&D[i]);
    sort(D+1,D+1+m);
	sort(L+1,L+1+n);
    scanf("%d",&Q);
    for(int i=1;i<=Q;i++)
	{
        ans=INF;
        int sy,sx,ty,tx;
        scanf("%d%d%d%d",&sy,&sx,&ty,&tx);
        int j=Fnd_D(sx),k=Fnd_L(sx);
        if(sy==ty) ans=abs(sx-tx);
        else
		{
            if(j>0)ans=min(ans,abs(sx-D[j])+(abs(ty-sy)-1)/V+1+abs(D[j]-tx));
            if(j<m)ans=min(ans,abs(sx-D[j+1])+(abs(ty-sy)-1)/V+1+abs(D[j+1]-tx));
            if(k>0)ans=min(ans,abs(sx-L[k])+abs(ty-sy)+abs(L[k]-tx));
            if(k<n)ans=min(ans,abs(sx-L[k+1])+abs(ty-sy)+abs(L[k+1]-tx));
        }
        printf("%d\n",ans);
    }
    return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3fffffff
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int Min1=INF,Min2=INF;
		int l=lb(stair+1,stair+cl+1,min(yf,yt))-stair-1;
		int r=ub(stair+1,stair+cl+1,max(yf,yt))-stair;
		l=max(l,1);
		r=min(r,cl);
		for(int i=l;i<=r;i++)
		{
			if(abs(stair[i]-yf)+abs(stair[i]-yt)<Min1)
			{
				Min1=abs(stair[i]-yf)+abs(stair[i]-yt);
				if(stair[i]>=min(yf,yt)&&stair[i]<=max(yf,yt))
				{
					break;
				}
			}
		}
		l=lb(elevator+1,elevator+ce+1,min(yf,yt))-elevator-1;
		r=ub(elevator+1,elevator+ce+1,max(yf,yt))-elevator;
		l=max(l,1);
		r=min(r,ce);
		for(int i=l;i<=r;i++)
		{
			if(abs(elevator[i]-yf)+abs(elevator[i]-yt)<Min2)
			{
				Min2=abs(elevator[i]-yf)+abs(elevator[i]-yt);
				if(elevator[i]>=min(yf,yt)&&elevator[i]<=max(yf,yt))
				{
					break;
				}
			}
		}
		printf("%d\n",min(Min1+disl,Min2+dise));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int Min1=INF,Min2=INF;
		int l=lb(stair+1,stair+cl+1,min(yf,yt))-stair-1;
		int r=ub(stair+1,stair+cl+1,max(yf,yt))-stair;
		l=max(l,1);
		r=min(r,cl);
		for(int i=l;i<=r;i++)
		{
			if(abs(stair[i]-yf)+abs(stair[i]-yt)<Min1)
			{
				Min1=abs(stair[i]-yf)+abs(stair[i]-yt);
				if(stair[i]>=min(yf,yt)&&stair[i]<=max(yf,yt))
				{
					break;
				}
			}
		}
		l=lb(elevator+1,elevator+ce+1,min(yf,yt))-elevator-1;
		r=ub(elevator+1,elevator+ce+1,max(yf,yt))-elevator;
		l=max(l,1);
		r=min(r,ce);
		for(int i=l;i<=r;i++)
		{
			if(abs(elevator[i]-yf)+abs(elevator[i]-yt)<Min2)
			{
				Min2=abs(elevator[i]-yf)+abs(elevator[i]-yt);
				if(elevator[i]>=min(yf,yt)&&elevator[i]<=max(yf,yt))
				{
					break;
				}
			}
		}
		printf("%d\n",min(Min1+disl,Min2+dise));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x7fffffff
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int l[4],e[4];

		int l1=lower_bound(stair+1,stair+cl+1,yf)-stair;
		if(l1-1>0)l[0]=stair[l1-1];
		else l[0]=INF;

		if(cl>0)l[1]=stair[l1];
		else l[1]=INF;

		int l2=lower_bound(stair+1,stair+cl+1,yt)-stair;
		if(l2-1>0)l[2]=stair[l2-1];
		else l[2]=INF;

		if(cl>0)l[3]=stair[l2];
		else l[3]=INF;

		int e1=lower_bound(elevator+1,elevator+ce+1,yf)-elevator;
		if(e1-1>0)e[0]=elevator[e1-1];
		else e[0]=INF;

		if(ce>0)e[1]=elevator[e1];
		else e[1]=INF;

		int e2=lower_bound(elevator+1,elevator+ce+1,yt)-elevator;
		if(e2-1>0)e[2]=elevator[e2-1];
		else e[2]=INF;

		if(ce>0)e[3]=elevator[e2];
		else e[3]=INF;

		int Min1=INF,ans1=0;
		for(int i=0;i<4;i++)
		{
			if(abs(l[i]-yf)+abs(l[i]-yt)<Min1)
			{
				Min1=abs(l[i]-yf)+abs(l[i]-yt);
				ans1=l[i];
			}
		}
		int ansl=Min1+disl;
		int Min2=INF,ans2=0;
		for(int i=0;i<4;i++)
		{
			if(abs(e[i]-yf)+abs(e[i]-yt)<Min2)
			{
				Min2=abs(e[i]-yf)+abs(e[i]-yt);
				ans2=e[i];
			}
		}
		int anse=Min2+dise;
		printf("%d\n",min(ansl,anse));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3f3f3f3f
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int l[4],e[4];

		int l1=lower_bound(stair+1,stair+cl+1,yf)-stair;
		if(l1-1>0)l[0]=stair[l1-1];
		else l[0]=INF;

		if(cl>0)l[1]=stair[l1];
		else l[1]=INF;

		int l2=lower_bound(stair+1,stair+cl+1,yt)-stair;
		if(l2-1>0)l[2]=stair[l2-1];
		else l[2]=INF;

		if(cl>0)l[3]=stair[l2];
		else l[3]=INF;

		int e1=lower_bound(elevator+1,elevator+ce+1,yf)-elevator;
		if(e1-1>0)e[0]=elevator[e1-1];
		else e[0]=INF;

		if(ce>0)e[1]=elevator[e1];
		else e[1]=INF;

		int e2=lower_bound(elevator+1,elevator+ce+1,yt)-elevator;
		if(e2-1>0)e[2]=elevator[e2-1];
		else e[2]=INF;

		if(ce>0)e[3]=elevator[e2];
		else e[3]=INF;

		int Min1=INF,ans1=0;
		for(int i=0;i<4;i++)
		{
			if(abs(l[i]-yf)+abs(l[i]-yt)<Min1)
			{
				Min1=abs(l[i]-yf)+abs(l[i]-yt);
				ans1=l[i];
			}
		}
		int ansl=Min1+disl;
		int Min2=INF,ans2=0;
		for(int i=0;i<4;i++)
		{
			if(abs(e[i]-yf)+abs(e[i]-yt)<Min2)
			{
				Min2=abs(e[i]-yf)+abs(e[i]-yt);
				ans2=e[i];
			}
		}
		int anse=Min2+dise;
		printf("%d\n",min(ansl,anse));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int Min1=INF,Min2=INF;
		int l=lb(stair+1,stair+cl+1,min(yf,yt))-stair-1;
		int r=ub(stair+1,stair+cl+1,max(yf,yt))-stair;
		l=max(l,1);
		r=min(r,cl);
		for(int i=l;i<=r;i++)
		{
			if(abs(stair[i]-yf)+abs(stair[i]-yt)<Min1)
			{
				Min1=abs(stair[i]-yf)+abs(stair[i]-yt);
			}
		}
		l=lb(elevator+1,elevator+ce+1,min(yf,yt))-elevator-1;
		r=ub(elevator+1,elevator+ce+1,max(yf,yt))-elevator;
		l=max(l,1);
		r=min(r,ce);
		for(int i=l;i<=r;i++)
		{
			if(abs(elevator[i]-yf)+abs(elevator[i]-yt)<Min2)
			{
				Min2=abs(elevator[i]-yf)+abs(elevator[i]-yt);
			}
		}
		printf("%d\n",min(Min1+disl,Min2+dise));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
int main()
{
	freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int Min1=INF,Min2=INF;
		int l=lb(stair+1,stair+cl+1,min(yf,yt))-stair-1;
		int r=ub(stair+1,stair+cl+1,max(yf,yt))-stair;
		l=max(l,1);
		r=min(r,cl);
		for(int i=l;i<=r;i++)
		{
			if(abs(stair[i]-yf)+abs(stair[i]-yt)<Min1)
			{
				Min1=abs(stair[i]-yf)+abs(stair[i]-yt);
			}
		}
		l=lb(elevator+1,elevator+ce+1,min(yf,yt))-elevator-1;
		r=ub(elevator+1,elevator+ce+1,max(yf,yt))-elevator;
		l=max(l,1);
		r=min(r,ce);
		for(int i=l;i<=r;i++)
		{
			if(abs(elevator[i]-yf)+abs(elevator[i]-yt)<Min2)
			{
				Min2=abs(elevator[i]-yf)+abs(elevator[i]-yt);
			}
		}
		printf("%d\n",min(Min1+disl,Min2+dise));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3fffffff
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
bool cmp(int a,int b)
{
	return a>b;
}
int find(int stair[],int cl,int yf,int yt)
{
	int pol;
	if(yf<=stair[1])pol=stair[1];
	else if(yf>=stair[cl])pol=stair[cl];
	else
	{
		int _l=lower_bound(stair+1,stair+cl+1,yf,cmp)-stair;
		int _r=lower_bound(stair+1,stair+cl+1,yf)-stair;
		if(abs(yf-_l)+abs(yt-_l)<abs(yf-_r)+abs(yt-_r))pol=_l;
		else pol=_r;
	}
	return abs(yf-pol)+abs(yt-pol);
}
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	sort(stair+1,stair+1+cl);
	sort(elevator+1,elevator+1+ce);
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int l=abs(xf-xt);
		int e=(abs(xf-xt)-1)/v+1;

		int pol=INF,poe=INF;
		int disl=INF,dise=INF;
		if(cl>0)
		{
			disl=find(stair,cl,yf,yt);
		}
		if(ce>0)
		{
			dise=find(elevator,ce,yf,yt);
		}
		printf("%d\n",min(disl+l,dise+e));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int Min1=INF,Min2=INF;
		int l=lb(stair+1,stair+cl+1,min(yf,yt))-stair-1;
		int r=ub(stair+1,stair+cl+1,max(yf,yt))-stair;
		for(int i=l;i<=r;i++)
		{
			if(abs(stair[i]-yf)+abs(stair[i]-yt)<Min1)
			{
				Min1=abs(stair[i]-yf)+abs(stair[i]-yt);
			}
		}
		l=lb(elevator+1,elevator+ce+1,min(yf,yt))-elevator-1;
		r=ub(elevator+1,elevator+ce+1,max(yf,yt))-elevator;
		for(int i=l;i<=r;i++)
		{
			if(abs(elevator[i]-yf)+abs(elevator[i]-yt)<Min2)
			{
				Min2=abs(elevator[i]-yf)+abs(elevator[i]-yt);
			}
		}
		printf("%d\n",min(Min1+disl,Min2+dise));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int Min1=INF,Min2=INF;
		int l=lb(stair+1,stair+cl+1,min(yf,yt))-stair-1;
		int r=ub(stair+1,stair+cl+1,max(yf,yt))-stair;
		r=min(r,cl);
		for(int i=l;i<=r;i++)
		{
			if(abs(stair[i]-yf)+abs(stair[i]-yt)<Min1)
			{
				Min1=abs(stair[i]-yf)+abs(stair[i]-yt);
			}
		}
		l=lb(elevator+1,elevator+ce+1,min(yf,yt))-elevator-1;
		r=ub(elevator+1,elevator+ce+1,max(yf,yt))-elevator;
		r=min(r,ce);
		for(int i=l;i<=r;i++)
		{
			if(abs(elevator[i]-yf)+abs(elevator[i]-yt)<Min2)
			{
				Min2=abs(elevator[i]-yf)+abs(elevator[i]-yt);
			}
		}
		printf("%d\n",min(Min1+disl,Min2+dise));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3fffffff
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
bool cmp(int a,int b)
{
	return a>b;
}
int find(int stair[],int cl,int yf,int yt)
{
	int pol;
	if(yf<=stair[1])pol=stair[1];
	else if(yf>=stair[cl])pol=stair[cl];
	else
	{
		int _l=lb(stair+1,stair+cl+1,yf,cmp)-stair;
		int _r=lb(stair+1,stair+cl+1,yf)-stair;
		if(abs(yf-_l)+abs(yt-_l)<abs(yf-_r)+abs(yt-_r))pol=_l;
		else pol=_r;
	}
	return abs(yf-pol)+abs(yt-pol);
}
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	stair[cl+1]=INF;
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	elevator[ce+1]=INF;
	sort(stair+1,stair+1+cl);
	sort(elevator+1,elevator+1+ce);
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int ans=INF;
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		if(xf==xt)
		{
			printf("%d\n",abs(yf-yt));
			continue;
		}
  		int l=abs(xf-xt);
		int e=(abs(xf-xt)-1)/v+1;
		if(yf>yt)swap(yf,yt);
		if(cl>0)
		{
			ans=min(find(stair,cl,yf,yt)+l,ans);
		}
		if(ce>0)
		{
   			ans=min(find(elevator,ce,yf,yt)+e,ans);
		}
		printf("%d\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3f3f3f3f
int stair[N];
int elevator[N];
int main()
{
	freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int l[4],e[4];

		int l1=lower_bound(stair+1,stair+cl+1,yf)-stair;
		if(l1-1>0)l[0]=stair[l1-1];
		else l[0]=INF;

		if(cl>0)l[1]=stair[l1];
		else l[1]=INF;

		int l2=lower_bound(stair+1,stair+cl+1,yt)-stair;
		if(l2-1>0)l[2]=stair[l2-1];
		else l[2]=INF;

		if(cl>0)l[3]=stair[l2];
		else l[3]=INF;

		int e1=lower_bound(elevator+1,elevator+ce+1,yf)-elevator;
		if(e1-1>0)e[0]=elevator[e1-1];
		else e[0]=INF;

		if(ce>0)e[1]=elevator[e1];
		else e[1]=INF;

		int e2=lower_bound(elevator+1,elevator+ce+1,yt)-elevator;
		if(e2-1>0)e[2]=elevator[e2-1];
		else e[2]=INF;

		if(ce>0)e[3]=elevator[e2];
		else e[3]=INF;

		int Min1=INF,ans1=0;
		for(int i=0;i<4;i++)
		{
			if(abs(l[i]-yf)+abs(l[i]-yt)<Min1)
			{
				Min1=abs(l[i]-yf)+abs(l[i]-yt);
				ans1=l[i];
			}
		}
		int ansl=Min1+disl;
		int Min2=INF,ans2=0;
		for(int i=0;i<4;i++)
		{
			if(abs(e[i]-yf)+abs(e[i]-yt)<Min2)
			{
				Min2=abs(e[i]-yf)+abs(e[i]-yt);
				ans2=e[i];
			}
		}
		int anse=Min2+dise;
		printf("%d\n",min(ansl,anse));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3f3f3f3f
int stair[N];
int elevator[N];
int main()
{
	freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int l[4],e[4];
		int l1=lower_bound(stair+1,stair+cl+1,yf)-stair;
		l[0]=stair[l1-1];
		l[1]=stair[l1];
		int l2=lower_bound(stair+1,stair+cl+1,yt)-stair;
		l[2]=stair[l2-1];
		l[3]=stair[l2];
		int e1=lower_bound(elevator+1,elevator+ce+1,yf)-elevator;
		e[0]=elevator[e1-1];
		e[1]=elevator[e1];
		int e2=lower_bound(elevator+1,elevator+ce+1,yt)-elevator;
		e[2]=elevator[e2-1];
		e[3]=elevator[e2];
		int Min1=INF,ans1=0;
		for(int i=0;i<4;i++)
		{
			if(abs(l[i]-yf)+abs(l[i]-yt)<Min1)
			{
				Min1=abs(l[i]-yf)+abs(l[i]-yt);
				ans1=l[i];
			}
		}
		int ansl=Min1+disl;
		int Min2=INF,ans2=0;
		for(int i=0;i<4;i++)
		{
			if(abs(e[i]-yf)+abs(e[i]-yt)<Min2)
			{
				Min2=abs(e[i]-yf)+abs(e[i]-yt);
				ans2=e[i];
			}
		}
		int anse=Min2+dise;
		printf("%d\n",min(ansl,anse));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3fffffff
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	stair[cl+1]=INF;
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	elevator[ce+1]=INF;
	sort(stair+1,stair+1+cl);
	sort(elevator+1,elevator+1+ce);
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int ans=INF;
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		if(xf==xt)
		{
			printf("%d\n",abs(yf-yt));
			continue;
		}
  		int l=abs(xf-xt);
		int e=(abs(xf-xt)-1)/v+1;
		if(yf>yt)swap(yf,yt);
		int j=lb(stair+1,stair+1+cl,yf)-stair;
		int k=lb(elevator+1,elevator+1+ce,yf)-elevator;
		if(j<=cl&&j>0)ans=min(ans,abs(yf-stair[j])+abs(yt-stair[j])+l);
		if(j>1&&j<=cl)ans=min(ans,abs(yf-stair[j-1])+abs(yt-stair[j-1])+l);
		if(k<=ce&&k>0)ans=min(ans,abs(yf-elevator[k])+abs(yt-elevator[k])+e);
		if(k>1&&k<=ce)ans=min(ans,abs(yf-elevator[k-1])+abs(yt-elevator[k-1])+e);
		printf("%d\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x7f7f7f7f
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int l[4],e[4];

		int l1=lower_bound(stair+1,stair+cl+1,yf)-stair;
		if(l1-1>0)l[0]=stair[l1-1];
		else l[0]=INF;

		if(cl>0)l[1]=stair[l1];
		else l[1]=INF;

		int l2=lower_bound(stair+1,stair+cl+1,yt)-stair;
		if(l2-1>0)l[2]=stair[l2-1];
		else l[2]=INF;

		if(cl>0)l[3]=stair[l2];
		else l[3]=INF;

		int e1=lower_bound(elevator+1,elevator+ce+1,yf)-elevator;
		if(e1-1>0)e[0]=elevator[e1-1];
		else e[0]=INF;

		if(ce>0)e[1]=elevator[e1];
		else e[1]=INF;

		int e2=lower_bound(elevator+1,elevator+ce+1,yt)-elevator;
		if(e2-1>0)e[2]=elevator[e2-1];
		else e[2]=INF;

		if(ce>0)e[3]=elevator[e2];
		else e[3]=INF;

		int Min1=INF,ans1=0;
		for(int i=0;i<4;i++)
		{
			if(abs(l[i]-yf)+abs(l[i]-yt)<Min1)
			{
				Min1=abs(l[i]-yf)+abs(l[i]-yt);
				ans1=l[i];
			}
		}
		int ansl=Min1+disl;
		int Min2=INF,ans2=0;
		for(int i=0;i<4;i++)
		{
			if(abs(e[i]-yf)+abs(e[i]-yt)<Min2)
			{
				Min2=abs(e[i]-yf)+abs(e[i]-yt);
				ans2=e[i];
			}
		}
		int anse=Min2+dise;
		printf("%d\n",min(ansl,anse));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3f3f3f3f
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int l[4],e[4];
		int l1=lower_bound(stair+1,stair+cl+1,yf)-stair;
		l[0]=stair[l1-1];
		l[1]=stair[l1];
		int l2=lower_bound(stair+1,stair+cl+1,yt)-stair;
		l[2]=stair[l2-1];
		l[3]=stair[l2];
		int e1=lower_bound(elevator+1,elevator+ce+1,yf)-elevator;
		e[0]=elevator[e1-1];
		e[1]=elevator[e1];
		int e2=lower_bound(elevator+1,elevator+ce+1,yt)-elevator;
		e[2]=elevator[e2-1];
		e[3]=elevator[e2];
		int Min1=INF,ans1=0;
		for(int i=0;i<4;i++)
		{
			if(abs(l[i]-yf)+abs(l[i]-yt)<Min1)
			{
				Min1=abs(l[i]-yf)+abs(l[i]-yt);
				ans1=l[i];
			}
		}
		int ansl=Min1+disl;
		int Min2=INF,ans2=0;
		for(int i=0;i<4;i++)
		{
			if(abs(e[i]-yf)+abs(e[i]-yt)<Min2)
			{
				Min2=abs(e[i]-yf)+abs(e[i]-yt);
				ans2=e[i];
			}
		}
		int anse=Min2+dise;
		printf("%d\n",min(ansl,anse));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3f3f3f3f
int stair[N];
int elevator[N];
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	int q;
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int disl=abs(xf-xt);
		int dise=(abs(xf-xt)-1)/v+1;
		int Min1=INF,Min2=INF;
		for(int i=1;i<=cl;i++)
		{
			if(abs(stair[i]-yf)+abs(stair[i]-yt)<Min1)
			{
				Min1=abs(stair[i]-yf)+abs(stair[i]-yt);
			}
		}
		for(int i=1;i<=ce;i++)
		{
			if(abs(elevator[i]-yf)+abs(elevator[i]-yt)<Min2)
			{
				Min2=abs(elevator[i]-yf)+abs(elevator[i]-yt);
			}
		}
		printf("%d\n",min(Min1+disl,Min2+dise));
	}
	return 0;
}


#include <bits/stdc++.h>
#define N 123456
using namespace std;
#define fi first
#define se second
#define INF 0x3fffffff
#define lb lower_bound
#define ub upper_bound
int stair[N];
int elevator[N];
bool cmp(int a,int b)
{
	return a>b;
}
int find(int stair[],int cl,int yf,int yt)
{
	int pol;
	if(yf<=stair[1])pol=stair[1];
	else if(yf>=stair[cl])pol=stair[cl];
	else
	{
		int _l=lb(stair+1,stair+cl+1,yf,cmp)-stair;
		int _r=lb(stair+1,stair+cl+1,yf)-stair;
		if(abs(yf-_l)+abs(yt-_l)<abs(yf-_r)+abs(yt-_r))pol=_l;
		else pol=_r;
	}
	return abs(yf-pol)+abs(yt-pol);
}
int main()
{
	//freopen("qc.in","r",stdin);
	int n,m,cl,ce,v;
	scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
	for(int i=1;i<=cl;i++)
	{
		scanf("%d",&stair[i]);
	}
	stair[cl+1]=INF;
	for(int i=1;i<=ce;i++)
	{
		scanf("%d",&elevator[i]);
	}
	elevator[ce+1]=INF;
	sort(stair+1,stair+1+cl);
	sort(elevator+1,elevator+1+ce);
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int xf,yf,xt,yt;
		scanf("%d%d%d%d",&xf,&yf,&xt,&yt);
		int l=abs(xf-xt);
		int e=(abs(xf-xt)-1)/v+1;
		if(yf>yt)swap(yf,yt);
		int disl=INF,dise=INF;
		if(cl>0)
		{
			disl=find(stair,cl,yf,yt);
		}
		if(ce>0)
		{
			dise=find(elevator,ce,yf,yt);
		}
		printf("%d\n",min(disl+l,dise+e));
	}
	return 0;
}