#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y, temp, temp1;
  cin >> n >> m >> x >> y;
  int a[100001], b[100001];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int j = 0; j < m; j++) {
    cin >> b[j];
  }
  int ans[100001][2];
  int k = 0;
  int index = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = index; j < m; j++) {
      if (b[j] - y > a[i]) break;
      if (b[j] + x < a[i]) {
        index = j + 1;
        continue;
      }
      if (b[j] >= a[i] - x && b[j] <= a[i] + y) {
        index = j + 1;
        cnt++;
        ans[k][0] = i + 1;
        ans[k][1] = j + 1;
        k++;
        break;
      }
    }
  }
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++) {
    cout << ans[i][0] << " " << ans[i][1] << endl;
  }
  return 0;
}
