#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y, i = 0, j = 0;
  vector<pair<int, int> > ans;
  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];
  }
  for (; i < n && j < m;) {
    if (a[i] - x <= b[j] && a[i] + y >= b[j]) {
      ans.push_back(make_pair(i + 1, j + 1));
      ++i, ++j;
    } else if (b[j] < a[i] - x)
      ++j;
    else
      ++i;
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}
