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