#include <bits/stdc++.h>
using namespace std;
long long a[100009], b[100009], c[100006], d[100005];
int main() {
  long long n, m, x, y;
  cin >> n >> m >> x >> y;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) cin >> b[i];
  long long ind = 0, cnt = 0;
  for (long long i = 0; i < n; i++) {
    long long l = a[i] - x;
    long long u = a[i] + y;
    for (long long j = ind; j < m; j++) {
      if (u < b[j]) {
        ind = j;
        break;
      }
      if (l > b[j]) {
        ind = j;
      }
      if (l <= b[j] && b[j] <= u) {
        c[cnt] = i + 1;
        d[cnt] = j + 1;
        cnt++;
        ind = j + 1;
        break;
      }
    }
  }
  cout << cnt << endl;
  for (long long i = 0; i < cnt; i++) cout << c[i] << " " << d[i] << endl;
  return 0;
}
