#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  long int x, y;
  cin >> n >> m >> x >> y;
  long int* a = new long int[n];
  long int* b = new long int[m];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  int count = -1, indi = 0, indj = 0;
  long int** res = new long int*[min(m, n)];
  while ((indi < n) && (indj < m))
    if (b[indj] < a[indi] - x)
      ++indj;
    else if (b[indj] > a[indi] + y)
      ++indi;
    else {
      res[(++count)] = new long int[2];
      res[count][0] = indi + 1;
      res[count][1] = indj + 1;
      ++indi;
      ++indj;
    }
  cout << count + 1 << endl;
  for (int i = 0; i < count + 1; i++)
    cout << res[i][0] << " " << res[i][1] << endl;
  return 0;
}
