#include <bits/stdc++.h>
using namespace std;
int n, m;
long long x, y;
unsigned long long skirt_size[100000];
struct war_size {
  unsigned long long from;
  unsigned long long to;
};
war_size wars[100000];
int comp(war_size a, war_size b) {
  if (a.from == b.from)
    return a.to < b.to;
  else
    return a.from < b.from;
}
vector<war_size> answer;
int main() {
  scanf("%d%d", &n, &m);
  scanf("%I64d%I64d", &x, &y);
  for (int i = 0; i < n; ++i) {
    long long t;
    scanf("%I64d", &t);
    wars[i].from = max((long long)0, t - x);
    wars[i].to = t + y;
  }
  for (int i = 0; i < m; ++i) scanf("%I64u", &skirt_size[i]);
  int counter = 0, i = 0, j = 0;
  while (i < n && j < m) {
    if (skirt_size[j] >= wars[i].from && skirt_size[j] <= wars[i].to) {
      war_size t;
      t.from = i;
      t.to = j;
      answer.push_back(t);
      ++counter;
      ++i;
      ++j;
    } else if (skirt_size[j] < wars[i].from)
      ++j;
    else
      ++i;
  }
  printf("%d\n", counter);
  for (i = 0; i < answer.size(); ++i) {
    printf("%I64d %I64d\n", answer[i].from + 1, answer[i].to + 1);
  }
  return 0;
}
