#include <bits/stdc++.h>
using namespace std;
int n, m, x, y;
pair<int, int> a[100001];
pair<int, int> b[100001];
int main() {
  scanf("%d%d%d%d", &n, &m, &x, &y);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i].first);
    a[i].second = i + 1;
  }
  sort(a, a + n);
  for (int i = 0; i < m; i++) {
    scanf("%d", &b[i].first);
    b[i].second = i + 1;
  }
  sort(b, b + m);
  vector<pair<int, int> > sol;
  int p1 = 0;
  for (int i = 0; i < n; i++) {
    while (p1 < m) {
      if (b[p1].first < a[i].first - x)
        p1++;
      else
        break;
    }
    if (p1 < m && b[p1].first <= a[i].first + y) {
      sol.push_back(make_pair(a[i].second, b[p1].second));
      p1++;
    }
  }
  cout << sol.size() << endl;
  for (int i = 0; i < sol.size(); i++)
    cout << sol[i].first << " " << sol[i].second << endl;
  return 0;
}
