#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, x, y;
  vector<long long> v1;
  vector<long long> v2;
  cin >> n >> m >> x >> y;
  int t = n;
  while (t--) {
    long long temp;
    cin >> temp;
    v1.push_back(temp);
  }
  t = m;
  while (t--) {
    long long temp;
    cin >> temp;
    v2.push_back(temp);
  }
  stringstream sss;
  long long count = 0;
  long long j = 0;
  long long lj = 0;
  for (long long i = 0, j = 0; i < v1.size() && j < v2.size();) {
    if (v2[j] > v1[i] + y) {
      i++;
    } else if (v2[j] < v1[i] - x) {
      j++;
    } else {
      i++;
      j++;
      count++;
      sss << i << " " << j << endl;
    }
  }
  cout << count << endl;
  cout << sss.str();
  return 0;
}
