#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000;
int N[maxn], M[maxn];
int pai[maxn][2];
int main() {
  int n, m, x, y;
  int i, j, sum, k;
  while (cin >> n >> m) {
    cin >> x >> y;
    for (i = 0; i < n; i++) cin >> N[i];
    for (i = 0; i < m; i++) cin >> M[i];
    i = 0;
    j = 0;
    sum = 0;
    k = 0;
    while (i != n && j != m) {
      if (M[j] < N[i] - x) {
        j++;
      } else if (M[j] > N[i] + y) {
        i++;
      } else {
        pai[k][0] = i + 1;
        pai[k++][1] = j + 1;
        i++;
        j++;
        sum++;
      }
    }
    cout << sum << endl;
    for (k = 0; k < sum; k++) cout << pai[k][0] << " " << pai[k][1] << endl;
    ;
  }
  return 0;
}
