#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
namespace std {
bool operator<(const complex<double>& a, const complex<double>& b) {
  return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
}  // namespace std
bool operator<(const pair<int, int> a, const pair<int, int> b) {
  return a.first != b.first ? a.first < b.first : a.second < b.second;
}
int a[444444], b[444444];
int main() {
  int n, m, x, y;
  scanf("%d%d%d%d", &n, &m, &x, &y);
  for (int i = (0); i < (int)(n); i++) {
    scanf("%d", &a[i]);
  }
  for (int i = (0); i < (int)(m); i++) {
    scanf("%d", &b[i]);
  }
  int i = 0;
  int j = 0;
  vector<pair<int, int> > ans;
  while (i < n && j < m) {
    if (a[i] - x <= b[j] && b[j] <= a[i] + y) {
      ans.push_back(make_pair(i + 1, j + 1));
      i++;
      j++;
    } else if (a[i] + y < b[j]) {
      i++;
    }
    if (a[i] - x > b[j]) {
      j++;
    }
  }
  printf("%d\n", ((int)(ans).size()));
  for (int i = (0); i < (int)(((int)(ans).size())); i++) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
