#include <bits/stdc++.h>
using namespace std;
long long i, j;
long long N, M, X, Y;
long long A[100005];
long long B[100005];
vector<pair<long long, long long> > ans;
int main() {
  scanf("%lld%lld%lld%lld", &N, &M, &X, &Y);
  for (i = 0; i < N; i++) scanf("%lld", &A[i]);
  for (i = 0; i < M; i++) scanf("%lld", &B[i]);
  long long prev = 0;
  for (i = 0; i < M; i++) {
    long long L = prev;
    long long R = N - 1;
    long long temp = -1;
    while (L <= R) {
      long long mid = L + (R - L) / 2;
      if ((A[mid] - X <= B[i]) && (A[mid] + Y >= B[i])) {
        temp = mid;
        R = mid - 1;
      } else if (A[mid] - X > B[i])
        R = mid - 1;
      else
        L = mid + 1;
    }
    if (temp != -1) {
      ans.push_back(make_pair(temp + 1, i + 1));
      prev = temp + 1;
    }
  }
  long long N = ans.size();
  printf("%lld\n", N);
  for (i = 0; i < N; i++) printf("%lld %lld\n", ans[i].first, ans[i].second);
  return 0;
}
