#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005];
pair<int, int> c[100005];
int main() {
  ios_base::sync_with_stdio(0);
  int m, n, x, y, f = 0;
  cin >> n >> m >> x >> y;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  int j = 0;
  for (int i = 0; i < n; i++) {
    while (b[j] < a[i] - x && j < m - 1) j++;
    if (b[j] >= a[i] - x && b[j] <= a[i] + y && j < m) {
      c[f].first = i + 1;
      c[f].second = j + 1;
      f++;
      j++;
    }
  }
  cout << f << "\n";
  for (int i = 0; i < f; i++) {
    cout << c[i].first << " " << c[i].second << "\n";
  }
}
