#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  int *a = new int[n];
  int *b = new int[m];
  vector<int> rea;
  vector<int> reb;
  for (int i = 0; i < n; i++) cin >> a[i];
  int k = 0;
  for (int i = 0; i < m; i++) cin >> b[i];
  int i = 0, j = 0;
  while (i < n && j < m) {
    if (a[i] - x <= b[j] && a[i] + y >= b[j]) {
      k++;
      rea.push_back(i);
      reb.push_back(j);
      j++;
      i++;
    }
    if (b[j] < a[i] - x)
      j++;
    else if (b[j] > a[i] + y)
      i++;
  }
  cout << k << endl;
  for (int i = 0; i < rea.size(); i++)
    cout << rea[i] + 1 << " " << reb[i] + 1 << endl;
  return 0;
}
