#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 1;
long long a[maxN], b[maxN], n, m, x, y;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m >> x >> y;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) cin >> b[i];
  int i = 1, j = 1, dem = 0;
  while (i <= n && j <= m) {
    if ((a[i] - x) > b[j])
      ++j;
    else if ((a[i] + y) < b[j])
      ++i;
    else {
      dem++;
      a[dem] = i;
      b[dem] = j;
      ++i;
      ++j;
    }
  }
  cout << dem;
  for (int i = 1; i <= dem; ++i) cout << '\n' << a[i] << ' ' << b[i];
}
