#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<int> arr(n), brr(m);
  for (int i = 0; i < n; ++i) scanf("%d", &arr[i]);
  for (int i = 0; i < m; ++i) scanf("%d", &brr[i]);
  int l = 0, r = 0;
  vector<pair<int, int> > ans;
  while (l < n && r < m) {
    if (arr[l] - x <= brr[r] && brr[r] <= arr[l] + y) {
      ans.push_back({++l, ++r});
      continue;
    }
    if (arr[l] < brr[r])
      ++l;
    else
      ++r;
  }
  cout << ans.size() << '\n';
  for (auto cur : ans) printf("%d %d\n", cur.first, cur.second);
}
