#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005];
vector<int> xx, yy;
int main() {
  int n, m, x, y;
  while (scanf("%d%d%d%d", &n, &m, &x, &y) > 0) {
    xx.clear();
    yy.clear();
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= m; i++) scanf("%d", &b[i]);
    int j = 1;
    int res = 0;
    for (int i = 1; i <= n; i++) {
      while (b[j] < a[i] - x) {
        j++;
        if (j > m) break;
      }
      if (j > m) break;
      if (b[j] >= a[i] - x && b[j] <= a[i] + y) {
        xx.push_back(i);
        yy.push_back(j);
        res++;
        j++;
      }
      if (j > m) break;
    }
    printf("%d\n", res);
    for (int i = 0; i < res; i++) printf("%d %d\n", xx[i], yy[i]);
  }
}
