#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
const int maxn = 100010;
using namespace std;
struct pnt {
  int x, y, num;
};
pnt a[maxn];
pnt b[maxn];
bool cmp(pnt a, pnt b) {
  if (a.x < b.x) {
    return true;
  } else if (a.x > b.x)
    return false;
  else
    return a.y < b.y;
}
int cnt = 0;
pnt res[maxn];
int main() {
  int n, m, i, j, x, y, v;
  cin >> n >> m >> x >> y;
  for (i = 0; i < n; ++i) {
    cin >> v;
    a[i].num = i + 1;
    a[i].x = v - x;
    a[i].y = v + y;
    a[i].x = max(a[i].x, 1);
  }
  for (i = 0; i < m; ++i) {
    cin >> b[i].x;
    b[i].y = 0;
    b[i].num = i + 1;
  }
  sort(a, a + n, cmp);
  sort(b, b + m, cmp);
  j = 0;
  for (i = 0; i < m; ++i) {
    while (j < n && a[j].x <= b[i].x) {
      if (b[i].x >= a[j].x && b[i].x <= a[j].y) {
        res[cnt].x = a[j].num;
        res[cnt].y = b[i].num;
        cnt++;
        ++j;
        break;
      }
      ++j;
    }
  }
  cout << cnt << "\n";
  for (i = 0; i < cnt; ++i) {
    cout << res[i].x << " " << res[i].y << "\n";
  }
  return 0;
}
