#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 1;
int n, m, x, y, a[MAX], b[MAX], res, mp[MAX];
int main() {
  ios_base::sync_with_stdio(0);
  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 j = 1;
  for (int i = 1; i <= n; ++i) {
    if (a[i] + y < b[j]) continue;
    while (j <= m && b[j] < a[i] - x) ++j;
    if (j > m) break;
    if (b[j] >= a[i] - x && b[j] <= a[i] + y) {
      ++res;
      mp[i] = j;
      ++j;
    }
  }
  cout << res << endl;
  for (int i = 1; i <= n; ++i)
    if (mp[i] != 0) cout << i << ' ' << mp[i] << endl;
  return 0;
}
