#include <bits/stdc++.h>
using namespace std;
namespace {
const int kMaxN = 100000;
int n, m, x, y, ans;
int a[kMaxN + 1], b[kMaxN + 1], c[kMaxN + 1];
void Solve(FILE *fin, FILE *fout) {
  fscanf(fin, "%d%d%d%d", &n, &m, &x, &y);
  for (int i = 1; i <= n; i++) fscanf(fin, "%d", &a[i]);
  int j = 1;
  for (int i = 1; i <= m; i++) {
    fscanf(fin, "%d", &b[i]);
    if (b[i] < a[j] - x) continue;
    while (j <= n && b[i] > a[j] + y) j++;
    if (j <= n && b[i] >= a[j] - x) {
      ans++;
      c[i] = j;
      j++;
    }
  }
  fprintf(fout, "%d\n", ans);
  for (int i = 1; i <= m; i++)
    if (c[i]) fprintf(fout, "%d %d\n", c[i], i);
}
}  // namespace
int main() {
  ::Solve(stdin, stdout);
  return 0;
}
