#include <bits/stdc++.h>
using namespace std;
template <typename T>
string toStr(const T &x) {
  ostringstream os;
  os << x;
  return os.str();
}
template <typename T>
void toMin(T &x, const T &y) {
  x = min(x, y);
}
template <typename T>
void toMax(T &x, const T &y) {
  x = max(x, y);
}
const int MAXN = 100005;
int n, m, x, y;
int s[MAXN], v[MAXN];
vector<pair<int, int> > ansList;
int main() {
  scanf("%d%d%d%d", &n, &m, &x, &y);
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &v[i]);
  }
  int ptr = 0;
  for (int i = 0; i < n; i++) {
    while (ptr < m && v[ptr] < s[i] - x) ptr++;
    if (ptr == m) break;
    if (s[i] - x <= v[ptr] && v[ptr] <= s[i] + y) {
      ansList.push_back(make_pair(i, ptr));
      ptr++;
    }
  }
  printf("%d\n", ((int)((ansList).size())));
  for (__typeof((ansList).begin()) it = (ansList).begin();
       it != (ansList).end(); ++it) {
    printf("%d %d\n", it->first + 1, it->second + 1);
  }
  return 0;
}
