#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  long long int n, m, x, y, pa = 0, t;
  cin >> n >> m >> x >> y;
  vector<long long int> a(n);
  vector<pair<int, int> > matches;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) {
    cin >> t;
    while (pa < n && t > a[pa] + y) pa++;
    if (a[pa] - x <= t && a[pa] + y >= t) {
      matches.push_back(pair<int, int>(pa + 1, i + 1));
      pa++;
    }
  }
  cout << matches.size() << endl;
  for (size_t i = 0; i < matches.size(); ++i)
    cout << matches[i].first << ' ' << matches[i].second << endl;
  return EXIT_SUCCESS;
}
