#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  vector<int> a, b;
  cin >> n >> m >> x >> y;
  int val;
  for (int i = 0; i < n; i++) {
    cin >> val;
    a.push_back(val);
  }
  for (int i = 0; i < m; i++) {
    cin >> val;
    b.push_back(val);
  }
  int ia = 0, ib = 0;
  int count = 0;
  vector<string> map;
  while (ia < n && ib < m) {
    if (a[ia] - x <= b[ib] && b[ib] <= a[ia] + y) {
      count++;
      long long iaS = ia + 1;
      long long ibS = ib + 1;
      map.push_back(to_string(iaS) + " " + to_string(ibS));
      ia++;
      ib++;
    } else if (a[ia] - x > b[ib]) {
      ib++;
    } else if (a[ia] + y < b[ib]) {
      ia++;
    }
  }
  cout << count << endl;
  for (int i = 0; i < map.size(); i++) {
    cout << map[i] << endl;
  }
  return 0;
}
