#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y, qq;
  scanf("%d %d %d %d", &n, &m, &x, &y);
  int a[100010];
  int b[100010];
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < m; ++i) scanf("%d", &b[i]);
  int p = 0, q = 0;
  int c = 0;
  vector<int> res;
  int fff = 0;
  while (p < n && q < m) {
    fff++;
    if (fff > 1000000) return -1;
    while (p < n && q < m && b[q] < a[p] - x) q++;
    while (p < n && q < m && b[q] > a[p] + y) p++;
    while (p < n && q < m && b[q] >= a[p] - x && b[q] <= a[p] + y) {
      res.push_back(p);
      res.push_back(q);
      c++;
      p++;
      q++;
    }
  }
  printf("%d\n", c);
  for (int i = 0; i < c; ++i)
    printf("%d %d\n", res[2 * i] + 1, res[2 * i + 1] + 1);
}
