#include <bits/stdc++.h>
int main() {
  int n, m, x, y, *a, *b, *c, i, j, k;
  scanf("%d %d %d %d", &n, &m, &x, &y);
  a = (int*)malloc(n * sizeof(int));
  c = (int*)malloc(n * sizeof(int));
  b = (int*)malloc(m * sizeof(int));
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 0; i < m; i++) scanf("%d", &b[i]);
  j = 0;
  k = 0;
  for (i = 0; i < n; i++) {
    for (; (j < m) && (b[j] < a[i] - x); j++)
      ;
    if ((j < m) && (b[j] <= a[i] + y)) {
      c[i] = j;
      j++;
      k++;
    } else
      c[i] = -1;
  }
  printf("%d\n", k);
  for (i = 0; i < n; i++)
    if (c[i] != -1) printf("%d %d\n", i + 1, c[i] + 1);
  printf("\n");
  return 0;
}
