#include <bits/stdc++.h>
using namespace std;
int a[100010], b[100010];
int r[100010][2];
int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) cin >> b[i];
  sort(a, a + n);
  sort(b, b + m);
  int k = 0, res = 0;
  for (int i = 0; i < n; ++i) {
    while (true) {
      if (a[i] - x <= b[k]) break;
      ++k;
      if (k == m) break;
    }
    if (k == m) break;
    if (a[i] - x <= b[k] && b[k] <= a[i] + y) {
      r[res][0] = i + 1;
      r[res][1] = k + 1;
      ++res;
      ++k;
      if (k == m) break;
    }
  }
  cout << res << endl;
  for (int i = 0; i < res; ++i) cout << r[i][0] << " " << r[i][1] << endl;
  return 0;
}
