#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000000")
using namespace std;
int main() {
  int n, m;
  long long x, y;
  cin >> n >> m >> x >> y;
  int S[100000], A[100000];
  vector<int> answer1;
  vector<int> answer2;
  for (int i = 0; i < n; i++) {
    cin >> S[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> A[i];
  }
  int sp = 0, ap = 0, sum = 0;
  for (; sp < n && ap < m;) {
    if (A[ap] >= S[sp] - x && A[ap] <= S[sp] + y) {
      sp++;
      ap++;
      answer1.push_back(ap);
      answer2.push_back(sp);
      continue;
    }
    if (A[ap] > S[sp] + y) {
      sp++;
      continue;
    }
    if (A[ap] < S[sp] - x) {
      ap++;
      continue;
    }
  }
  cout << answer1.size() << endl;
  for (int i = 0; i < answer1.size(); i++) {
    cout << answer2[i] << " " << answer1[i] << endl;
  }
  return 0;
}
