#include <bits/stdc++.h>
using namespace std;
int myGCD(int a, int b) {
  if (b == 0)
    return a;
  else
    return myGCD(b, a % b);
}
int myPOW(int a, int b) {
  int val;
  if (b == 0) return 1;
  if (b == 1) return a;
  val = myPOW(a, b / 2);
  val = val * val;
  return (b % 2) ? val * a : val;
}
int main() {
  int n, m, first, second;
  scanf("%d%d%d%d", &n, &m, &first, &second);
  vector<int> av;
  vector<int> gv;
  int k;
  int i, j;
  for (i = 0; i < n; i++) {
    scanf("%d", &k);
    av.push_back(k);
  }
  for (j = 0; j < m; j++) {
    scanf("%d", &k);
    gv.push_back(k);
  }
  sort(av.begin(), av.end());
  sort(gv.begin(), gv.end());
  vector<pair<int, int> > ans;
  int fl = 0;
  int cta = 0, ctb = 0;
  while (cta < n && ctb < m) {
    if (gv[ctb] <= av[cta] + second && gv[ctb] >= av[cta] - first) {
      ans.push_back(pair<int, int>(cta + 1, ctb + 1));
      cta++;
      ctb++;
    } else if (av[cta] + second < gv[ctb])
      cta++;
    else if (av[cta] - first > gv[ctb]) {
      while (ctb < m && av[cta] - first > gv[ctb]) ctb++;
    }
  }
  int tot = ans.size();
  printf("%d\n", tot);
  for (i = 0; i < tot; i++) printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
