#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<int> vn(n);
  vector<int> vm(m);
  for (int i = 0; i < n; i++) {
    cin >> vn[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> vm[i];
  }
  int np = 0;
  int mp = 0;
  vector<pair<int, int>> ans;
  while (np < n && mp < m) {
    if (vm[mp] >= vn[np] - x && vm[mp] <= vn[np] + y) {
      ans.push_back(make_pair(np, mp));
      np++;
      mp++;
    } else if (vm[mp] < vn[np] - x) {
      mp++;
    } else {
      np++;
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
  }
  return 0;
}
