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