#include <bits/stdc++.h>
using namespace std;
int n, m, x, y;
vector<int> A;
vector<int> B;
vector<pair<int, int> > sol;
int main() {
  int t1;
  scanf("%d%d%d%d", &n, &m, &x, &y);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t1);
    A.push_back(t1);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &t1);
    B.push_back(t1);
  }
  for (int i = 0, j = 0; i < n && j < m;) {
    if (A[i] - x <= B[j] && B[j] <= A[i] + y) {
      i++;
      j++;
      sol.push_back(make_pair(i, j));
    } else if (A[i] - x > B[j]) {
      j++;
    } else {
      i++;
    }
  }
  int sz = sol.size();
  printf("%d\n", sz);
  for (int i = 0; i < sz; i++) {
    printf("%d %d\n", sol[i].first, sol[i].second);
  }
  return 0;
}
