#include <bits/stdc++.h>
int n, m, x, y, a[100005], b[100005], id, ans, px[100005], py[100005];
int main() {
  scanf("%d%d%d%d", &n, &m, &x, &y);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= m; ++i) scanf("%d", &b[i]);
  id = 1;
  ans = 0;
  for (int i = 1; i <= n; ++i) {
    while (id <= m && (b[id] < a[i] - x)) ++id;
    if (id <= m && b[id] <= a[i] + y) {
      px[++ans] = i;
      py[ans] = id;
      ++id;
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i <= ans; ++i) printf("%d %d\n", px[i], py[i]);
  return 0;
}
