#include <bits/stdc++.h>
using namespace std;
int a[100005];
int b[100005];
bool c[100005] = {0};
vector<pair<int, int> > ans;
int main() {
  int n, m, x, y;
  scanf("%d %d %d %d", &n, &m, &x, &y);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &b[i]);
  }
  for (int i = 1, j = 1; i <= n; ++i) {
    while (j <= m && (b[j] < a[i] - x || c[j])) {
      j++;
    }
    if (j > m) break;
    if (b[j] <= a[i] + y && !c[j]) {
      ans.push_back({i, j});
      c[j] = 1;
    }
  }
  printf("%d\n", (int)ans.size());
  for (auto [u, v] : ans) {
    printf("%d %d\n", u, v);
  }
}
