#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m, x, y;
  scanf("%d%d%d%d", &n, &m, &x, &y);
  vector<int> a, b;
  for (int i = 0; i < (n); ++i) {
    int t;
    scanf("%d", &t);
    a.push_back(t);
  }
  for (int i = 0; i < (m); ++i) {
    int t;
    scanf("%d", &t);
    b.push_back(t);
  }
  int j = 0;
  vector<pair<int, int> > res;
  for (int i = 0; i < (n); ++i) {
    for (; j < m; ++j) {
      if (b[j] < a[i] - x)
        continue;
      else {
        if (b[j] <= a[i] + y) {
          res.push_back(make_pair(i + 1, j + 1));
          ++j;
        }
        break;
      }
    }
  }
  printf("%d\n", ((int)((res).size())));
  for (__typeof((res).begin()) it = (res).begin(); it != (res).end(); ++it)
    printf("%d %d\n", it->first, it->second);
  return 0;
}
