#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  vector<pair<int, int> > v;
  cin >> n >> m >> x >> y;
  vector<int> a(n), b(m);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) cin >> b[i];
  int i = 0, j = 0;
  while (i < n and j < m) {
    if (a[i] - x <= b[j] and b[j] <= a[i] + y) {
      v.push_back(make_pair(i + 1, j + 1));
      ++i;
      ++j;
    } else if (a[i] - x > b[j])
      ++j;
    else
      ++i;
  }
  cout << v.size() << endl;
  for (int k = 0; k < v.size(); ++k)
    cout << v[k].first << ' ' << v[k].second << endl;
}
