#include <bits/stdc++.h>
using namespace std;
long long solds[110000], vests[110000];
long long a, b;
pair<int, int> solutions[110000];
int inRange(int s, int v) {
  return (solds[s] - a <= vests[v] && solds[s] + b >= vests[v]);
}
int main() {
  int S, V;
  cin >> S >> V >> a >> b;
  for (int i = 1; i <= S; i++) {
    scanf("%I64d", &solds[i]);
  }
  for (int i = 1; i <= V; i++) scanf("%I64d", &vests[i]);
  int solved = 0, sIdx = 1, vIdx = 1;
  while (sIdx <= S && vIdx <= V) {
    if (inRange(sIdx, vIdx)) {
      pair<int, int> p(sIdx, vIdx);
      solutions[solved++] = p;
      sIdx++;
      vIdx++;
    } else {
      if (solds[sIdx] - a > vests[vIdx])
        vIdx++;
      else
        sIdx++;
    }
  }
  printf("%d\n", solved);
  for (int i = 0; i < solved; i++) {
    printf("%d %d\n", solutions[i].first, solutions[i].second);
  }
  return 0;
}
