#include <bits/stdc++.h>
using namespace std;
struct A {
  int val, id;
};
A a[112345];
A b[112345];
bool fs(A p, A q) { return p.val < q.val; }
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].val;
    a[i].id = i;
  }
  for (int i = 1; i <= m; i++) {
    cin >> b[i].val;
    b[i].id = i;
  }
  sort(a + 1, a + 1 + n, fs);
  sort(b + 1, b + 1 + m, fs);
  int i = 1, j = 1;
  vector<pair<int, int> > v;
  while (i <= n && j <= m) {
    if (b[j].val >= a[i].val - x && b[j].val <= a[i].val + y) {
      v.push_back(make_pair(a[i].id, b[j].id));
      i++, j++;
    } else if (b[j].val < a[i].val - x)
      j++;
    else
      i++;
  }
  cout << v.size() << "\n";
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << "\n";
  return 0;
}
