#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<int> a(n), b(m);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 0; j < m; j++) cin >> b[j];
  int j = 0;
  vector<pair<int, int> > res;
  for (int i = 0; i < n; i++) {
    while (j < m && b[j] < a[i] - x) j++;
    if (j < m && b[j] <= a[i] + y) {
      res.push_back(make_pair(i, j));
      j++;
    }
  }
  cout << (int((res).size())) << '\n';
  for (auto x : res) cout << x.first + 1 << ' ' << x.second + 1 << '\n';
  return 0;
}
