#include <bits/stdc++.h>
using namespace std;
int n;
int m;
int x, y;
int s[100000 + 5];
int v[100000 + 5];
int p[100000 + 5];
int last;
int giveV(int n, int m) {
  int cs = 0, cv = 0, tot = 0;
  while (cs < n && cv < m) {
    if (v[cv] >= (s[cs] - x)) {
      if (v[cv] <= (s[cs] + y)) {
        p[cs] = cv + 1;
        tot++;
        last = cs;
        cs++;
        cv++;
      } else
        cs++;
    } else
      cv++;
  }
  return tot;
}
int main() {
  int total;
  memset(s, 0, sizeof(s));
  memset(v, 0, sizeof(v));
  memset(p, 0, sizeof(p));
  scanf("%d %d %d %d", &n, &m, &x, &y);
  for (int i = 0; i < n; i++) scanf("%d", &s[i]);
  for (int i = 0; i < m; i++) scanf("%d", &v[i]);
  total = giveV(n, m);
  printf("%d\n", total);
  for (int i = 0; i <= last; i++)
    if (p[i] != 0) printf("%d %d\n", i + 1, p[i]);
}
