#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a, b;
  cin >> n >> m >> a >> b;
  int i;
  int arr[100009];
  int brr[100009];
  for (i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (i = 0; i < m; ++i) {
    cin >> brr[i];
  }
  int k = 0;
  vector<pair<int, int> > ans;
  for (i = 0; i < n; ++i) {
    while (k < m && arr[i] - a > brr[k]) ++k;
    if (k < m && arr[i] - a <= brr[k] && arr[i] + b >= brr[k]) {
      ans.push_back(make_pair(i + 1, k + 1));
      ++k;
    }
  }
  cout << ans.size() << endl;
  for (i = 0; i < ans.size(); ++i) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}
