#include <bits/stdc++.h>
using namespace std;
const int maxn = 100500;
int a[maxn];
int b[maxn];
int main() {
  int n, m, x, y;
  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]);
  vector<pair<int, int> > ans;
  for (int i = 0, j = 0; i < n && j < m; ++i) {
    while (j < m && b[j] < a[i] - x) ++j;
    if (j < m && b[j] <= a[i] + y) {
      ans.push_back(make_pair(i + 1, j + 1));
      ++j;
    }
  }
  printf("%d\n", (int)ans.size());
  for (int i = 0; i < ans.size(); ++i)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
