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