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