#include <bits/stdc++.h>
using namespace std;
int n, m, x, y;
pair<int, int> p[200000], q[200000];
vector<pair<int, int> > ans;
int main() {
  scanf("%d%d%d%d", &n, &m, &x, &y);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &p[i].first);
    p[i].second = i;
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &q[i].first);
    q[i].second = i;
  }
  sort(p + 1, p + n + 1);
  sort(q + 1, q + m + 1);
  int pos = 0;
  for (int i = 1; i <= n; ++i) {
    int ind =
        lower_bound(q + pos + 1, q + m + 1, make_pair(p[i].first - x, -1)) - q;
    if (ind <= m && q[ind].first <= p[i].first + y) {
      ans.push_back(make_pair(p[i].second, q[ind].second));
      pos = ind;
    }
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < (int)ans.size(); ++i) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
