#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  int a[n + 1], b[m + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
  }
  sort(a + 1, a + 1 + n);
  sort(b + 1, b + 1 + m);
  int l = 1, r = 1, ans = 0;
  vector<int> p1, p2;
  while (1) {
    if (l > n || r > m) break;
    if (b[r] >= a[l] - x && b[r] <= a[l] + y) {
      p1.push_back(l);
      p2.push_back(r);
      ans++;
      l++;
      r++;
    } else if (b[r] < a[l] - x) {
      r++;
    } else {
      l++;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    cout << p1[i] << " " << p2[i] << endl;
  }
  return 0;
}
