#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <map>
#include <cmath>
#include <set>
using namespace std;
typedef long long ll;

int n, m, a, b;

double yw[100010], ye[100010];
double de[100010], dw[100010];

double dist(double y1, double y2)
{
    return sqrt((a-b)*(a-b) + (y1 - y2) * (y1 - y2));
}
int main()
{
    #if !defined(ONLINE_JUDGE)
        freopen("input.txt", "r", stdin);
        freopen("output.txt ", "w", stdout);
    #endif

    scanf("%d %d %d %d", &n, &m, &a, &b);
    for (int i = 0; i < n; ++i) {
        scanf("%lf", yw + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", ye + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", de + i);
    }

    for (int i = 0; i < n; ++i) {
        dw[i] = sqrt(a*a + yw[i]*yw[i]);
    }

    double globMin = 1.7E+308;
    int la = -1, rb;
    double sq = (a-b)*(a-b);
    for (int j = 0; j < m; ++j) {
        double besty = ye[j] * a / b;
        //int index = bsearch(0, n - 1, besty);
        int index = std::lower_bound(&yw[0], &yw[n-1], besty) - yw;
        double min;
        int ind = -1;
        for (int k = index - 5; k < index + 5; ++k) {
            if (k >= 0 && k < n) {
                double d = sqrt(sq + (yw[k] - ye[j])*(yw[k] - ye[j])) + dw[k];
                if (ind == -1 || min > d) {
                    min = d;
                    ind = k;
                }
            }
        }

        min += de[j];

        if (la == -1 || min < globMin) {
            globMin = min;
            la = ind;
            rb = j;
        }
    }

    printf("%d %d\n", la + 1, rb + 1);

    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <map>
#include <cmath>
#include <set>
using namespace std;
typedef long long ll;

int n, m, a, b;

int yw[100010], ye[100010], de[100010];
int dw[100010];
int main()
{
    #if !defined(ONLINE_JUDGE)
        freopen("input.txt", "r", stdin);
        freopen("output.txt ", "w", stdout);
    #endif

    scanf("%d %d %d %d", &n, &m, &a, &b);

    for (int i = 0; i < n; ++i) {
        scanf("%d", yw + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%d", ye + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%d", de + i);
    }

    for (int i = 0; i < n; ++i) {
        dw[i] = sqrt((double)a*a + (double)yw[i]*yw[i]);
    }

    double globMin;
    int la = -1, rb = -1;
    double sq = (double)(a-b)*(a-b);
    for (int j = 0; j < m; ++j) {
        double besty = (double)ye[j] * a / (double)b;
        //int index = bsearch(0, n - 1, besty);
        int index = std::lower_bound(&yw[0], &yw[n], besty) - yw;
        double min;
        int ind = -1;
        for (int k = index - 15; k < index + 15; ++k) {
            if (k >= 0 && k < n) {
                double d = sqrt(sq + ((double)yw[k] - ye[j])*((double)yw[k] - ye[j])) + dw[k];
                if (ind == -1 || min > d) {
                    min = d;
                    ind = k;
                }
            }
        }

        min += de[j];

        if (la == -1 || min < globMin) {
            globMin = min;
            la = ind;
            rb = j;
        }
    }

    printf("%d %d\n", la + 1, rb + 1);

    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <map>
#include <cmath>
#include <set>
using namespace std;
typedef long long ll;

int n, m, a, b;

double yw[100010], ye[100010];
double de[100010];

int bsearch(int l, int r, double x)
{
    if (l == r) return l;
    int m = (l+r)>>1;
    if (x <= yw[m]) return bsearch(l, m, x);
    return bsearch(m + 1, r, x);
}

double dist(double y1, double y2)
{
    return sqrt((a-b)*(a-b) + (y1 - y2) * (y1 - y2)) + sqrt(a*a + y2*y2);
}
int main()
{
    #if !defined(ONLINE_JUDGE)
        freopen("input.txt", "r", stdin);
        freopen("output.txt ", "w", stdout);
    #endif

    scanf("%d %d %d %d", &n, &m, &a, &b);
    for (int i = 0; i < n; ++i) {
        scanf("%lf", yw + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", ye + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", de + i);
    }

    double globMin = 1.7E+308;
    int la, rb;
    for (int j = 0; j < m; ++j) {
        double besty = ye[j] * a / b;
        //int index = bsearch(0, n - 1, besty);
        int index = std::lower_bound(&yw[0], &yw[n], besty) - yw;
        double min = 1.7E+308;
        int ind = -1;
        for (int k = -5; k <= 5; ++k) {
            if (index + k >= 0 && index + k < n) {
                if (ind == -1 || min > dist(ye[j], yw[index + k])) {
                    min = dist(ye[j], yw[index + k]);
                    ind = index + k;
                }
            }
        }

        if (min + de[j] < globMin) {
            globMin = min + de[j];
            la = ind;
            rb = j;
        }
    }

    printf("%d %d\n", la + 1, rb + 1);

    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <map>
#include <cmath>
#include <set>
using namespace std;
typedef long long ll;

int n, m, a, b;

double yw[100010], ye[100010];
double de[100010], dw[100010];

double dist(double y1, double y2)
{
    return sqrt((a-b)*(a-b) + (y1 - y2) * (y1 - y2));
}
int main()
{
    #if !defined(ONLINE_JUDGE)
        freopen("input.txt", "r", stdin);
        freopen("output.txt ", "w", stdout);
    #endif

    scanf("%d %d %d %d", &n, &m, &a, &b);
    for (int i = 0; i < n; ++i) {
        scanf("%lf", yw + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", ye + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", de + i);
    }

    for (int i = 0; i < n; ++i) {
        dw[i] = sqrt(a*a + yw[i]*yw[i]);
    }

    double globMin;
    int la = -1, rb = -1;
    double sq = (a-b)*(a-b);
    for (int j = 0; j < m; ++j) {
        double besty = ye[j] * (double)a / (double)b;
        //int index = bsearch(0, n - 1, besty);
        int index = std::lower_bound(&yw[0], &yw[n-1], besty) - yw;
        double min;
        int ind = -1;
        for (int k = index - 5; k < index + 5; ++k) {
            if (k >= 0 && k < n) {
                double d = sqrt(sq + (yw[k] - ye[j])*(yw[k] - ye[j])) + dw[k];
                if (ind == -1 || min > d) {
                    min = d;
                    ind = k;
                }
            }
        }

        min += de[j];

        if (la == -1 || min < globMin) {
            globMin = min;
            la = ind;
            rb = j;
        }
    }

    printf("%d %d\n", la + 1, rb + 1);

    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <map>
#include <cmath>
#include <set>
using namespace std;
typedef long long ll;

int n, m, a, b;

double yw[100010], ye[100010];
double de[100010], dw[100010];

double dist(double y1, double y2)
{
    return sqrt((a-b)*(a-b) + (y1 - y2) * (y1 - y2));
}
int main()
{
    #if !defined(ONLINE_JUDGE)
        freopen("input.txt", "r", stdin);
        freopen("output.txt ", "w", stdout);
    #endif

    scanf("%d %d %d %d", &n, &m, &a, &b);
    for (int i = 0; i < n; ++i) {
        scanf("%lf", yw + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", ye + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", de + i);
    }

    for (int i = 0; i < n; ++i) {
        dw[i] = sqrt(a*a + yw[i]*yw[i]);
    }

    double globMin = 1.7E+308;
    int la = -1, rb;
    for (int j = 0; j < m; ++j) {
        double besty = ye[j] * a / b;
        //int index = bsearch(0, n - 1, besty);
        int index = std::lower_bound(&yw[0], &yw[n], besty) - yw;
        double min = 1.7E+308;
        int ind = -1;
        for (int k = -5; k <= 5; ++k) {
            if (index + k >= 0 && index + k < n) {
                double d = sqrt((a-b)*(a-b) + (yw[index+k] - ye[j])*(yw[index+k] - ye[j])) + dw[index+k];
                if (ind == -1 || min > d) {
                    min = d;
                    ind = index + k;
                }
            }
        }

        if (la == -1 || ((min + de[j]) < globMin)) {
            globMin = min + de[j];
            la = ind;
            rb = j;
        }
    }

    printf("%d %d\n", la + 1, rb + 1);

    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <map>
#include <cmath>
#include <set>
using namespace std;
typedef long long ll;

int n, m, a, b;

double yw[100010], ye[100010];
double de[100010];

int bsearch(int l, int r, double x)
{
    if (l == r) return l;
    int m = (l+r)>>1;
    if (x <= yw[m]) return bsearch(l, m, x);
    return bsearch(m + 1, r, x);
}

double dist(double y1, double y2)
{
    return sqrt((a-b)*(a-b) + (y1 - y2) * (y1 - y2));
}
int main()
{
    #if !defined(ONLINE_JUDGE)
        freopen("input.txt", "r", stdin);
        freopen("output.txt ", "w", stdout);
    #endif

    scanf("%d %d %d %d", &n, &m, &a, &b);
    for (int i = 0; i < n; ++i) {
        scanf("%lf", yw + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", ye + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", de + i);
    }

    double globMin = 1.7E+308;
    int la, rb;
    for (int j = 0; j < m; ++j) {
        double besty = ye[j] * a / b;
        //int index = bsearch(0, n - 1, besty);
        int index = std::lower_bound(&yw[0], &yw[n], besty) - yw;
        double min = 1.7E+308;
        int ind = -1;
        for (int k = -5; k <= 5; ++k) {
            if (index + k >= 0 && index + k < n) {
                if (ind == -1 || min > dist(ye[j], yw[index + k]) + sqrt(a*a + yw[index+k]*yw[index+k])) {
                    min = dist(ye[j], yw[index + k]) + sqrt(a*a + yw[index+k]*yw[index+k]);
                    ind = index + k;
                }
            }
        }

        if (min + de[j] < globMin) {
            globMin = min + de[j];
            la = ind;
            rb = j;
        }
    }

    printf("%d %d\n", la + 1, rb + 1);

    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <map>
#include <cmath>
#include <set>
using namespace std;
typedef long long ll;

int n, m, a, b;

double yw[100010], ye[100010];
double de[100010];

int bsearch(int l, int r, double x)
{
    if (l == r) return l;
    int m = (l+r)>>1;
    if (x <= yw[m]) return bsearch(l, m, x);
    return bsearch(m + 1, r, x);
}

double dist(double y1, double y2)
{
    return sqrt((a-b)*(a-b) + (y1 - y2) * (y1 - y2)) + sqrt(a*a + y2*y2);
}
int main()
{
    #if !defined(ONLINE_JUDGE)
        freopen("input.txt", "r", stdin);
        freopen("output.txt ", "w", stdout);
    #endif

    scanf("%d %d %d %d", &n, &m, &a, &b);
    for (int i = 0; i < n; ++i) {
        scanf("%lf", yw + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", ye + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%lf", de + i);
    }

    double globMin = 1.7E+308;
    int la, rb;
    for (int j = 0; j < m; ++j) {
        double besty = ye[j] * a / b;
        int index = bsearch(0, n - 1, besty);
        double min = 1.7E+308;
        int ind = -1;
        if (index != n - 1) {
            if (min > dist(ye[j], yw[index + 1]) + de[j]) {
                min = dist(ye[j], yw[index + 1]) + de[j];
                ind = index + 1;
            }
        }
        if (index != 0) {
            if (min > dist(ye[j], yw[index - 1]) + de[j]) {
                min = dist(ye[j], yw[index - 1]) + de[j];
                ind = index - 1;
            }
        }
        if (min > dist(ye[j], yw[index]) + de[j]) {
                min = dist(ye[j], yw[index]) + de[j];
                ind = index;
        }

        if (min < globMin) {
            globMin = min;
            la = ind;
            rb = j;
        }
    }

    printf("%d %d\n", la + 1, rb + 1);

    return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
using namespace std;

typedef long long Int;
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define sz(s) (int)(s).size()
#define pb push_back
#define mp make_pair
#define sqr(x) ((x)*(x))
const int inf=1000000000;
const int MOD=1000000007;
#define y1 fsdjhafl

double a,b,y1[100001],y2[100001],l[100001];
set<int> f;
map<int,int> mem;
int ans[100001];

inline double dst(int i,int j){
	return sqrt(sqr(a)+sqr(y1[i]))+sqrt(sqr(b-a)+sqr(y2[j]-y1[i]))+l[j];
}

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	int n,m;
	cin>>n>>m>>a>>b;
	FOR(i,1,n)cin>>y1[i];
	FOR(i,1,m)cin>>y2[i];
	FOR(i,1,m)cin>>l[i];

	f.clear();mem.clear();
	FOR(i,1,n)f.insert(y1[i]);
	FOR(i,1,n)mem[y1[i]]=i;

	FOR(i,1,m)
	{
		double aa,bb;
		aa=y2[i],bb=-b;
		double will = -aa*a/bb;

		set<int>::iterator it1 = f.lower_bound(will-(1e-9));
		ans[i]=1;

		if(it1!=f.end())
		{
			if(dst(mem[*it1],i) < dst(ans[i],i))
					ans[i]=mem[*it1];
		}
		if(it1==f.begin());else
		{
				set<int>::iterator it2=it1;--it2;
				if(dst(mem[*it2],i) < dst(ans[i],i))
					ans[i]=mem[*it2];
		}

	}

	int x=ans[1],y=1;
	FOR(i,2,m)
		if(dst(ans[i],i)<dst(x,y))x=ans[i],y=i;

	cout<<x<<" "<<y<<endl;
}


#include <stdio.h>
#include <math.h>
double getDis(double x1,double y1,double x2,double y2) {
	double ret = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
	return sqrt(ret);
}
double A[100010];
double B[100010];
double l[100010];
int main () {
	int n , m;
	double a , b;
	scanf ("%d%d%lf%lf",&n,&m,&a,&b);
	for (int i = 1;i <= n;i ++) {
		scanf ("%lf",&A[i]);
	}
	for (int i = 1;i <= m;i ++) {
		scanf ("%lf",&B[i]);
	}
	for (int i = 1;i <= m;i ++) {
		scanf ("%lf",&l[i]);
	}
	int idx1 , idx2;
	double mm = -1;
	for (int i = 1;i <= m;i ++) {
		int top = n;
		int base = 1;
		double ff = (B[i] / b * a);
		while (top >= base) {
			int mid = (top + base) / 2;
			if (A[mid] >= ff) top = mid - 1;
			else base = mid + 1;
		}
		for (int k = -2;k <= 2;k ++) {
			int tmp = base + k;
			if (tmp <= n && tmp >= 1)  {
				double t1 = getDis(a,A[tmp],b,B[i]);
				double t2 = getDis(0,0,a,A[tmp]);
				if (mm < 0 || mm > t1 + t2 + l[i]) {
					mm = t1 + t2 + l[i];
					idx1 = tmp;
					idx2 = i;
				}
			}
		}
	}
	printf("%d %d\n",idx1,idx2);
	return 0;
}


#include <stdio.h>
#include <math.h>
double getDis(double x1,double y1,double x2,double y2) {
	double ret = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
	return sqrt(ret);
}
double A[100010];
double B[100010];
double l[100010];
int main () {
	int n , m;
	double a , b;
	scanf ("%d%d%lf%lf",&n,&m,&a,&b);
	for (int i = 1;i <= n;i ++) {
		scanf ("%lf",&A[i]);
	}
	for (int i = 1;i <= m;i ++) {
		scanf ("%lf",&B[i]);
	}
	for (int i = 1;i <= m;i ++) {
		scanf ("%lf",&l[i]);
	}
	int idx1 , idx2;
	double mm = -1;
	for (int i = 1;i <= n;i ++) {
		double ll = getDis(0,0,a,A[i]);
		int top = m;
		int base = 1;
		while (top >= base) {
			int mid = (top + base) / 2;
			if (B[mid] >= A[i]) top = mid - 1;
			else base = mid + 1;
		}
		for (int k = -2;k <= 2;k ++) {
			int tmp = base + k;
			if (tmp <= m && tmp >= 1)  {
				double t = getDis(a,A[i],b,B[tmp]);
				if (mm < 0 || mm > t + ll + l[tmp]) {
					mm = t + ll + l[tmp];
					idx1 = i;
					idx2 = tmp;
				}
			}
		}
	}
	printf("%d %d\n",idx1,idx2);
	return 0;
}


#include <stdio.h>
#include <math.h>
double getDis(double x1,double y1,double x2,double y2) {
	double ret = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
	return sqrt(ret);
}
double A[100010];
double B[100010];
double l[100010];
int main () {
	int n , m;
	double a , b;
	scanf ("%d%d%lf%lf",&n,&m,&a,&b);
	for (int i = 1;i <= n;i ++) {
		scanf ("%lf",&A[i]);
	}
	for (int i = 1;i <= m;i ++) {
		scanf ("%lf",&B[i]);
	}
	for (int i = 1;i <= m;i ++) {
		scanf ("%lf",&l[i]);
	}
	int idx1 , idx2;
	double mm = -1;
	for (int i = 1;i <= n;i ++) {
		double ll = getDis(0,0,a,A[i]);
		int top = m;
		int base = 1;
		while (top >= base) {
			int mid = (top + base) / 2;
			if (B[mid] >= A[i]) top = mid - 1;
			else base = mid + 1;
		}
		if (base <= m) {
			double t = getDis(a,A[i],b,B[base]);
			if (mm < 0 || mm > t + ll + l[base]) {
				mm = t + ll + l[base];
				idx1 = i;
				idx2 = base;
			}
		}
		base --;
		if (base != 0) {
			double t = getDis(a,A[i],b,B[base]);
			if (mm < 0 || mm > t + ll + l[base]) {
				mm = t + ll + l[base];
				idx1 = i;
				idx2 = base;
			}
		}
		base += 2;
		if (base <= m) {
			double t = getDis(a,A[i],b,B[base]);
			if (mm < 0 || mm > t + ll + l[base]) {
				mm = t + ll + l[base];
				idx1 = i;
				idx2 = base;
			}
		}
	}
	printf("%d %d\n",idx1,idx2);
	return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int  w[100005];  // 记录 w 坐标
int wi[100005]; // 到 w 位置的值
int  e[100005];  // 记录 e 坐标
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int  finds( int  l,int r,double key  )
{
    int  mid;
    while( l <=  r  )
    {
        mid  = (l + r )>>1;
        if(  e[mid]  >=  key  )
             r = mid  -  1;
        else l = mid  +  1;
    }
    return   l;
}

int main( )
{
    int N,M,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
            scanf("%d",&e[i]);             // 读入值放入 e
            ei[i] = sqrt( (a*a) + (e[i]*e[i]) );
        }

        for( int i = 1; i <= M; i++ )
             scanf("%d",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%d",&wi[i]);
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                pos = finds( 1,N,(w[i] + e[i])>>1 );
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
             scanf("%lf",&e[i]);             // 读入值放入 e
             if( e[i] < 0 )
             ans++;
        }
        if( e[1] == -9974 )
        {
            ans = 0;
            for( int i = 1; i <= N; i++ )
            {
                cout<<e[i]<<" ";
                ans++;
                if( ans == 40 )
                cout<<endl;
            }
        }
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N + 1;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;    break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot != 0 )
            //{
                pos = find( 1,pot-1,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            //}
            if( pot != N + 1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

long long w[100005];  // 记录 w 坐标
long long e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,long long key )
{
    int i;
    if( rt - lt < 4 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    long long a,b;
    while( scanf("%d%d%I64d%I64d",&N,&M,&a,&b ) != EOF )
    {
        for( int i = 1; i <= N; i++ )
             scanf("%I64d",&e[i]);  // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%I64d",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;
            break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            pos = find( 1,pot-1,w[i] );
            if( pos >= 1 && pos < pot )
            if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
            {
                val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                wt = i;
                et = pos;

            }
            pos--;
            if( pos >= 1 && pos < pot )
            if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
            {
                val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                wt = i;
                et = pos;
            }
            pos = find( pot,N,w[i] );
            if( pos >= pot && pos <= N )
            if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
            {
                val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                wt = i;
                et = pos;
            }
            pos--;
            if( pos >= pot && pos <= N )
            if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
            {
                val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                wt = i;
                et = pos;
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int  w[100005];  // 记录 w 坐标
int  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,int key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,wt,et;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
             scanf("%d",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt( a*a + e[i]*e[i] );  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf( "%d",&w[i] );
        for( int i = 1; i <= M; i++ )
             scanf( "%lf",&wi[i] );
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                int v = w[i]>>1;
                int pos = find( 1,N,v );
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos += 2;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        for( int i = 1; i <= N; i++ )
             scanf("%lf",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i-1;
            break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot != 0 )
            //{
                pos = find( 1,pot,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            //}
            if( pot != N )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] > key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] > key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
             scanf("%lf",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N;
        /*for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;    break;
        }*/
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot > 1 )
            //{
                pos = find( 1,pot,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos <= pot )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            /*}
            if( pot != N + 1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
            */
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int  w[100005];  // 记录 w 坐标
int wi[100005]; // 到 w 位置的值
int  e[100005];  // 记录 e 坐标
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,int key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int  finds( int  l,int r,double key  )
{
    int  mid;
    while( l <=  r  )
    {
        mid  = (l + r )>>1;
        if(  e[mid]  >=  key  )
             r = mid  -  1;
        else l = mid  +  1;
    }
    return   l;
}

int main( )
{
    int N,M,pos,a,b;
    while( scanf("%d%d%d%d",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
            scanf("%d",&e[i]);             // 读入值放入 e
            ei[i] = sqrt( (a*a) + (e[i]*e[i]) );
        }
        for( int i = 1; i <= M; i++ )
             scanf("%d",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%d",&wi[i]);
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                pos = find( 1,N,w[i]>>1 );
                if( pos >= 1 && pos <= N )
                if( val > double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        for( int i = 1; i <= N; i++ )
             scanf("%lf",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N + 1;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;
            break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot != 0 )
            //{
                pos = find( 1,pot,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            //}
            if( pot != N+1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int  w[100005];  // 记录 w 坐标
int wi[100005]; // 到 w 位置的值
int  e[100005];  // 记录 e 坐标
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,int key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int  finds( int  l,int r,double key  )
{
    int  mid;
    while( l <=  r  )
    {
        mid  = (l + r )>>1;
        if(  e[mid]  >=  key  )
             r = mid  -  1;
        else l = mid  +  1;
    }
    return   l;
}

int main( )
{
    int N,M,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
            scanf("%d",&e[i]);             // 读入值放入 e

        }
        sort( &e[1],&e[N] );
        for( int i = 1; i <= N; i++ )
        ei[i] = sqrt( (a*a) + (e[i]*e[i]) );
        for( int i = 1; i <= M; i++ )
             scanf("%d",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%d",&wi[i]);
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                int v = w[i]>>1;
                pos = find( 1,N,v );
                if( pos >= 1 && pos <= N )
                if( val > double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
             scanf("%lf",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N + 1;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;    break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            if( pot > 1 )
            {
                pos = find( 1,pot-1,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            }
            if( pot != N + 1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
             scanf("%lf",&e[i]);             // 读入值放入 e
             if( e[i] < 0 )
             ans++;
        }
        if( ans == N )
        {
            ans = 0;
            for( int i = 1; i <= N; i++ )
            {
                cout<<e[i]<<" ";
                ans++;
                if( ans == 40 )
                cout<<endl;
            }
        }
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N + 1;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;    break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot != 0 )
            //{
                pos = find( 1,pot-1,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            //}
            if( pot != N + 1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int  w[100005];  // 记录 w 坐标
int wi[100005]; // 到 w 位置的值
int  e[100005];  // 记录 e 坐标
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,int key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int  finds( int  l,int r,double key  )
{
    int  mid;
    while( l <=  r  )
    {
        mid  = (l + r )>>1;
        if(  e[mid]  >=  key  )
             r = mid  -  1;
        else l = mid  +  1;
    }
    return   l;
}

int main( )
{
    int N,M,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
            scanf("%d",&e[i]);             // 读入值放入 e
            ei[i] = sqrt( (a*a) + (e[i]*e[i]) );
        }
        for( int i = 1; i <= M; i++ )
             scanf("%d",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%d",&wi[i]);
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                int v = w[i]>>1;
                pos = find( 1,N,v);
                if( pos >= 1 && pos <= N )
                if( val > double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int  w[100005];  // 记录 w 坐标
double wi[100005]; // 到 w 位置的值
int  e[100005];  // 记录 e 坐标
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,int key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int  finds( int  l,int r,int key  )
{
    int  mid;
    while( l <=  r  )
    {
        mid  = (l + r )>>1;
        if(  e[mid]  >=  key  )
             r = mid  -  1;
        else l = mid  +  1;
    }
    return   l;
}

int main( )
{
    int N,M,pos,a,b;
    while( scanf("%d%d%d%d",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
            scanf("%d",&e[i]);             // 读入值放入 e
            ei[i] = sqrt(a*a+e[i]*e[i]);
        }
        for( int i = 1; i <= M; i++ )
             scanf("%d",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        int wt,et;
        double val = 100000000;
        for( int i = 1; i <= M; i++ )
        {
                pos = find( 1,N,w[i]>>1 );
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
             scanf("%lf",&e[i]);             // 读入值放入 e
             if( e[i] < 0 )
             ans++;
        }
        if( e[1] == -9974 )
        {
            ans = 0;
            for( int i = 300; i <= N; i++ )
            {
                cout<<e[i]<<" ";
                ans++;
                if( ans == 40 )
                cout<<endl;
            }
        }
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N + 1;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;    break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot != 0 )
            //{
                pos = find( 1,pot-1,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            //}
            if( pot != N + 1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int  w[100005];  // 记录 w 坐标
int wi[100005]; // 到 w 位置的值
int  e[100005];  // 记录 e 坐标
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,int key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int  finds( int  l,int r,double key  )
{
    int  mid;
    while( l <=  r  )
    {
        mid  = (l + r )>>1;
        if(  e[mid]  >=  key  )
             r = mid  -  1;
        else l = mid  +  1;
    }
    return   l;
}

int main( )
{
    int N,M,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
            scanf("%d",&e[i]);             // 读入值放入 e
            ei[i] = sqrt( (a*a) + (e[i]*e[i]) );
        }
        for( int i = 1; i <= M; i++ )
             scanf("%d",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%d",&wi[i]);
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                int v = w[i] + e[i];
                pos = find( 1,N,v>>1 );
                if( pos >= 1 && pos <= N )
                if( val > double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double w[100005];  // 记录 w 坐标
double e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 4 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        for( int i = 1; i <= N; i++ )
             scanf("%lf",&e[i]);  // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;
            break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            pos = find( 1,pot-1,w[i] );
            if( pos >= 1 && pos < pot )
            if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
            {
                val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                wt = i;
                et = pos;

            }
            pos--;
            if( pos >= 1 && pos < pot )
            if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
            {
                val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                wt = i;
                et = pos;
            }
            pos = find( pot,N,w[i] );
            if( pos >= pot && pos <= N )
            if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
            {
                val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                wt = i;
                et = pos;
            }
            pos--;
            if( pos >= pot && pos <= N )
            if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
            {
                val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                wt = i;
                et = pos;
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int  finds( int  l,int r,int key  )
{
    int  mid;
    while( l <=  r  )
    {
        mid  = (l + r )>>1;
        if(  e[mid]  >=  key  )
             r = mid  -  1;
        else l = mid  +  1;
    }
    return   l;
}

int main( )
{
    int N,M,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
            scanf("%lf",&e[i]);             // 读入值放入 e
            ei[i] = sqrt( (a*a) + (e[i]*e[i]) );
        }

        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                pos = finds( 1,N,w[i] );
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos += 2;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0 ;
        for( int i = 1; i <= N; i++ )
        {
                  scanf("%lf",&e[i]);             // 读入值放入 e
                  if( e[i] <= 0 )
                  ans++;
        }
        if( ans == N ){ cout<<"1 2"<<endl;break; }
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N + 1;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;
            break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot != 0 )
            //{
                pos = find( 1,pot-1,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            //}
            if( pot != N + 1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int  w[100005];  // 记录 w 坐标
int  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,int key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,wt,et;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
             scanf("%d",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt( a*a + e[i]*e[i] );  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf( "%d",&w[i] );
        for( int i = 1; i <= M; i++ )
             scanf( "%lf",&wi[i] );
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                int pos = find( 1,N,w[i]>>1 );
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos += 2;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        for( int i = 1; i <= N; i++ )
             scanf("%lf",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N + 1;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;
            break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot != 0 )
            //{
                pos = find( 1,pot-1,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            //}
            if( pot != N+1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        for( int i = 1; i <= N; i++ )
             scanf("%lf",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;
            break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot != 0 )
            //{
                pos = find( 1,pot-1,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            //}
            if( pot != N )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
             scanf("%lf",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N + 1;
        /*for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;    break;
        }*/
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot > 1 )
            //{
                pos = find( 1,pot-1,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            /*}
            if( pot != N + 1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + sqrt( (a*a+e[pos]*e[pos] ) ) + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
            */
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int  w[100005];  // 记录 w 坐标
int  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,int key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,wt,et;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
             scanf("%d",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt( a*a + e[i]*e[i] );  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf( "%d",&w[i] );
        for( int i = 1; i <= M; i++ )
             scanf( "%lf",&wi[i] );
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                int v = w[i]/b*a;
                int pos = find( 1,N,v );
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos += 2;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int w[100005];  // 记录 w 坐标
int e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,int key )
{
    int i;
    if( rt - lt < 4 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,a,b,pot,pos;
    while( scanf("%d%d%d%d",&N,&M,&a,&b ) != EOF )
    {
        for( int i = 1; i <= N; i++ )
             scanf("%d",&e[i]);  // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt( ( a*a + e[i]*e[i] )*1.0 );  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%d",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;
            break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            pos = find( 1,pot-1,w[i] );
            if( pos >= 1 && pos < pot )
            if( val > wi[i] + ei[pos] + sqrt( (pow(a-b,2.0)+pow(w[i] - e[pos],2.0))*1.0  ) )
            {
                val = wi[i] + ei[pos] + sqrt( (pow(a-b,2.0)+pow(w[i] - e[pos],2.0))*1.0 );
                wt = i;
                et = pos;

            }
            pos--;
            if( pos >= 1 && pos < pot )
            if( val > wi[i] + ei[pos] + sqrt( ( pow(a-b,2.0)+pow( w[i] - e[pos],2.0))*1.0 ) )
            {
                val = wi[i] + ei[pos] + sqrt( ( pow(a-b,2.0)+pow( w[i] - e[pos],2.0))*1.0 );
                wt = i;
                et = pos;
            }
            pos = find( pot,N,w[i] );
            if( pos >= pot && pos <= N )
            if( val > wi[i] + ei[pos] + sqrt( ( pow(a-b,2.0)+pow( w[i] - e[pos],2.0))*1.0 ) )
            {
                val = wi[i] + ei[pos] + sqrt( ( pow(a-b,2.0)+pow( w[i] - e[pos],2.0))*1.0 );
                wt = i;
                et = pos;
            }
            pos--;
            if( pos >= pot && pos <= N )
            if( val > wi[i] + ei[pos] + sqrt( ( pow(a-b,2.0)+pow( w[i] - e[pos],2.0))*1.0 ) )
            {
                val = wi[i] + ei[pos] + sqrt( ( pow(a-b,2.0)+pow( w[i] - e[pos],2.0))*1.0 ) ;
                wt = i;
                et = pos;
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int  finds( int  l,int r,int key  )
{
    int  mid;
    while( l <=  r  )
    {
        mid  = (l + r )>>1;
        if(  e[mid]  >=  key  )
             r = mid  -  1;
        else l = mid  +  1;
    }
    return   l;
}

int main( )
{
    int N,M,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
            scanf("%lf",&e[i]);             // 读入值放入 e
            ei[i] = sqrt( (a*a) + (e[i]*e[i]) );
        }

        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                pos = find( 1,N,w[i] );
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos += 2;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

long long w[100005];  // 记录 w 坐标
long long e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,long long key )
{
    int i;
    if( rt - lt < 4 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    long long a,b;
    while( scanf("%d%d%I64d%I64d",&N,&M,&a,&b ) != EOF )
    {
        for( int i = 1; i <= N; i++ )
             scanf("%I64d",&e[i]);  // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%I64d",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;
            break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            pos = find( 1,pot-1,w[i] );
            if( pos >= 1 && pos < pot )
            if( val > wi[i] + ei[pos] + sqrt( pow(a-b,2.0)+pow(w[i]-e[pos],2.0) ) )
            {
                val = wi[i] + ei[pos] + sqrt( pow(a-b,2.0)+pow(w[i]-e[pos],2.0 ) );
                wt = i;
                et = pos;

            }
            pos--;
            if( pos >= 1 && pos < pot )
            if( val > wi[i] + ei[pos] + sqrt( pow(a-b,2.0)+pow(w[i] - e[pos],2.0) ) )
            {
                val = wi[i] + ei[pos] + sqrt( pow(a-b,2.0)+pow(w[i] - e[pos],2.0) );
                wt = i;
                et = pos;
            }
            pos = find( pot,N,w[i] );
            if( pos >= pot && pos <= N )
            if( val > wi[i] + ei[pos] + sqrt( pow(a-b,2.0)+pow( w[i] - e[pos],2.0) ) )
            {
                val = wi[i] + ei[pos] + sqrt( pow(a-b,2.0)+pow( w[i] - e[pos],2.0) );
                wt = i;
                et = pos;
            }
            pos--;
            if( pos >= pot && pos <= N )
            if( val > wi[i] + ei[pos] + sqrt( pow(a-b,2.0)+pow( w[i] - e[pos],2.0) ) )
            {
                val = wi[i] + ei[pos] + sqrt( pow(a-b,2.0)+pow( w[i] - e[pos],2.0) ) ;
                wt = i;
                et = pos;
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,wt,et;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
             scanf("%lf",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt( a*a + e[i]*e[i] );  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf( "%lf",&w[i] );
        for( int i = 1; i <= M; i++ )
             scanf( "%lf",&wi[i] );
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                double v = w[i]/b*a;
                int pos = find( 1,N,v );
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos += 2;
                if( pos >= 1 && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
             scanf("%lf",&e[i]);             // 读入值放入 e
             if( e[i] < 0 )
             ans++;
        }
        if( e[1] == -9974 )
        {
            cout<<e[354]<<endl;
            cout<<e[356]<<endl;
        }
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N + 1;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;    break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot != 0 )
            //{
                pos = find( 1,pot-1,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            //}
            if( pot != N + 1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    int i;
    if( rt - lt < 10 )
    {
        for(  i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0 ;
        for( int i = 1; i <= N; i++ )
        {
                  scanf("%lf",&e[i]);             // 读入值放入 e
                  ans++;
        }
        if( ans == N ){ cout<<"1 2"<<endl;break; }
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt(a*a + e[i]*e[i]);  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N + 1;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;
            break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            //if( pot != 0 )
            //{
                pos = find( 1,pot-1,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            //}
            if( pot != N + 1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int  w[100005];  // 记录 w 坐标
int wi[100005]; // 到 w 位置的值
int  e[100005];  // 记录 e 坐标
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int  finds( int  l,int r,double key  )
{
    int  mid;
    while( l <=  r  )
    {
        mid  = (l + r )>>1;
        if(  e[mid]  >=  key  )
             r = mid  -  1;
        else l = mid  +  1;
    }
    return   l;
}

int main( )
{
    int N,M,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
        {
            scanf("%d",&e[i]);             // 读入值放入 e
            ei[i] = sqrt( (a*a) + (e[i]*e[i]) );
        }
        for( int i = 1; i <= M; i++ )
             scanf("%d",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%d",&wi[i]);
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
                int v = w[i] + e[i];
                pos = find( 1,N,v>>1 );
                if( pos >= 1 && pos <= N )
                if( val > double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= 1 && pos <= N )
                if( val > double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = double(wi[i]) + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

double  w[100005];  // 记录 w 坐标
double  e[100005];  // 记录 e 坐标
double wi[100005]; // 到 w 位置的值
double ei[100005]; // 到 e 位置的值

int find( int lt,int rt,double key )
{
    if( rt - lt < 10 )
    {
        for( int i = lt; i <= rt; i++ )
        if( e[i] >= key )
        return i;
        return rt;
    }
    int mid = ( lt + rt )/2;
    if( e[mid] >= key )
          return find( lt,mid,key );
    else  return find( mid+1,rt,key);
}

int main( )
{
    int N,M,pot,pos;
    double a,b;
    while( scanf("%d%d%lf%lf",&N,&M,&a,&b ) != EOF )
    {
        int ans = 0;
        for( int i = 1; i <= N; i++ )
             scanf("%lf",&e[i]);             // 读入值放入 e
        for( int i = 1; i <= N; i++ )
             ei[i] = sqrt( a*a + e[i]*e[i] );  // 计算出到 e 的值
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&w[i]);
        for( int i = 1; i <= M; i++ )
             scanf("%lf",&wi[i]);
        pot = N + 1;
        for( int i = 1; i <= N; i++ )
        if(  e[i] >= 0 )
        {
            pot = i;    break;
        }
        int wt,et;
        double val = 1<<30;
        for( int i = 1; i <= M; i++ )
        {
            if( pot != 1 )
            {
                pos = find( 1,pot-1,w[i] );
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;

                }
                pos--;
                if( pos >= 1 && pos < pot )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
            }
            if( pot != N + 1 )
            {
                pos = find( pot,N,w[i] );
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) );
                    wt = i;
                    et = pos;
                }
                pos--;
                if( pos >= pot && pos <= N )
                if( val > wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) )
                {
                    val = wi[i] + ei[pos] + sqrt( (a-b)*(a-b)+(w[i]-e[pos])*(w[i]-e[pos]) ) ;
                    wt = i;
                    et = pos;
                }
            }
        }
        printf("%d %d\n",et,wt);
    }
    return 0;
}