#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, a[100010], b[100010], f[100010], g[100010], cur, ans;
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]);
  ans = cur = 0;
  for (int i = 0; i < n && cur < m; i++) {
    while (b[cur] < a[i] - x && cur < m) cur++;
    if (cur < m && b[cur] <= a[i] + y) {
      f[ans] = i + 1;
      g[ans++] = ++cur;
    }
  }
  printf("%d\n", ans);
  for (int i = 0; i < ans; i++) printf("%d %d\n", f[i], g[i]);
  return 0;
}
