#include <bits/stdc++.h>
struct P {
  int x, y;
} rec[100010];
int a[100010], b[100010];
int main() {
  int n, m, x, y;
  while (scanf("%d%d%d%d", &n, &m, &x, &y) != EOF) {
    for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
    for (int i = 0; i < m; ++i) scanf("%d", &b[i]);
    int j = 0, nr = 0;
    for (int i = 0; i < n; ++i) {
      while (j < m && b[j] < a[i] - x) ++j;
      if (j < m && a[i] - x <= b[j] && b[j] <= a[i] + y) {
        rec[nr].x = i;
        rec[nr++].y = j++;
      }
    }
    printf("%d\n", nr);
    for (int i = 0; i < nr; ++i) {
      printf("%d %d\n", rec[i].x + 1, rec[i].y + 1);
    }
  }
  return 0;
}
