#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, x, y;
int a[N];
int b[N];
int main() {
  scanf("%d%d%d%d", &n, &m, &x, &y);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d", b + i);
  }
  int p1, p2;
  p1 = p2 = 0;
  vector<pair<int, int> > ans;
  while (p1 < n && p2 < m) {
    if (a[p1] - x <= b[p2] && b[p2] <= a[p1] + y) {
      ans.push_back(make_pair(p1 + 1, p2 + 1));
      ++p1;
      ++p2;
    } else if (a[p1] + y < b[p2]) {
      ++p1;
    } else if (a[p1] - x > b[p2]) {
      ++p2;
    }
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); ++i) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
