#include <bits/stdc++.h>
using namespace std;
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
int main(int argc, char* argv[]) {
  int n, m, x, y, tmp;
  vector<int> a, b;
  cin >> n >> m >> x >> y;
  int k = 0;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    a.push_back(tmp);
  }
  for (int i = 0; i < m; i++) {
    cin >> tmp;
    b.push_back(tmp);
  }
  map<int, int> s;
  int i = 0, j = 0;
  while (i < n && j < m) {
    if (((a[i] - x) <= b[j]) && (b[j] <= (a[i] + y))) {
      s[i + 1] = j + 1;
      ++k;
      ++i;
      ++j;
    } else if (b[j] > (a[i] - x)) {
      ++i;
    } else if (b[j] < (a[i] - x)) {
      ++j;
    }
  }
  cout << k << endl;
  for (auto& e : s) {
    cout << e.first << " " << e.second << endl;
  }
  return 0;
}
