#include <bits/stdc++.h>
int a[100000], b[100000];
int result_a[100000], result_b[100000];
int main() {
  int x, y, n, m, i, j, total;
  scanf("%d %d %d %d", &n, &m, &x, &y);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (j = 0; j < m; j++) scanf("%d", &b[j]);
  total = 0;
  j = 0;
  i = 0;
  while (j < m && i < n) {
    if (a[i] - x > b[j])
      j++;
    else if (a[i] + y < b[j])
      i++;
    else {
      result_a[total] = i + 1;
      result_b[total] = j + 1;
      total++;
      i++;
      j++;
    }
  }
  printf("%d\n", total);
  for (i = 0; i < total; i++) printf("%d %d\n", result_a[i], result_b[i]);
  return 0;
}
