#include <bits/stdc++.h>
using namespace std;
int v[100500];
int w[100500];
int main() {
  int n, k, x, y;
  scanf("%d %d %d %d", &n, &k, &x, &y);
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
  }
  for (int i = 0; i < k; i++) {
    scanf("%d", &w[i]);
  }
  int i = 0;
  vector<pair<int, int> > res;
  for (int j = 0; j < k; j++) {
    while (1) {
      if (i == n) break;
      if (w[j] >= v[i] - x && w[j] <= v[i] + y) {
        res.push_back(make_pair(i + 1, j + 1));
        i++;
        break;
      } else if (w[j] > v[i] + y)
        i++;
      else {
        break;
      }
    }
  }
  printf("%d\n", (int)res.size());
  for (int i = 0; i < res.size(); i++) {
    printf("%d %d\n", res[i].first, res[i].second);
  }
  return 0;
}
