#include <bits/stdc++.h>
using namespace std;
struct name {
  long long a, b;
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, n, m, x, y, l, r, L, R, j, coun;
  cin >> n >> m >> x >> y;
  long long b[m];
  name a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i].a;
    a[i].b = -1;
  }
  for (i = 0; i < m; i++) cin >> b[i];
  l = a[0].a - x;
  r = a[n - 1].a + y;
  L = b[0];
  R = b[m - 1];
  if (l > R)
    cout << 0;
  else if (r < L)
    cout << 0;
  else {
    j = 0;
    coun = 0;
    for (i = 0; i < n; i++) {
      while (j != m) {
        if (b[j] <= (a[i].a + y) && b[j] >= (a[i].a - x)) {
          a[i].b = j;
          j++;
          coun++;
          break;
        } else if (b[j] > a[i].a + y)
          break;
        else
          j++;
      }
    }
    if (coun > 0) {
      cout << coun << endl;
      for (i = 0; i < n; i++) {
        if (a[i].b != -1) cout << i + 1 << " " << a[i].b + 1 << endl;
      }
    } else
      cout << coun;
  }
}
