#include <bits/stdc++.h>
using namespace std;
int ans[100010][2];
int main() {
  int n, m, x, y;
  int s[100010], v[100010];
  cin >> n >> m >> x >> y;
  for (int i = 0; i < n; ++i) {
    scanf("%d", s + i);
  }
  for (int j = 0; j < m; ++j) {
    scanf("%d", v + j);
  }
  int uk = 0;
  int j = 0;
  for (int i = 0; i < n; ++i) {
    bool find = false;
    for (int p = j; p < m; ++p) {
      if (v[p] >= s[i] - x && v[p] <= s[i] + y) {
        ans[uk][0] = i + 1;
        ans[uk][1] = p + 1;
        uk++;
        j = p + 1;
        find = true;
        break;
      }
      if (s[i] + y < v[p]) {
        find = true;
        break;
      }
    }
    if (!find) break;
  }
  printf("%d\n", uk);
  for (int i = 0; i < uk; ++i) {
    printf("%d %d\n", ans[i][0], ans[i][1]);
  }
  return 0;
}
