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