#include <bits/stdc++.h>
using namespace std;
int binary3(int arr[], int r, int l, int x) {
  while (r > l) {
    int mid = l + (r - l) / 2;
    if (arr[mid] >= x)
      r = mid;
    else
      l = mid + 1;
  }
  return r;
}
int binary(int arr[], int r, int l, int x) {
  while (r > l) {
    int mid = l + (r - l + 1) / 2;
    if (arr[mid] > x)
      r = mid - 1;
    else
      l = mid;
  }
  return l;
}
int main() {
  vector<pair<int, int> > v;
  int x, y, z, f, arr[100000], ar[100000];
  cin >> x >> y >> z >> f;
  for (int i = 0; i < x; i++) cin >> ar[i];
  for (int i = 0; i < y; i++) cin >> arr[i];
  int e = 0, w = 0, n = 0, s = 0;
  for (int j = 0; j < x; j++) {
    w = binary(arr, y - 1, n, ar[j] + f);
    e = binary3(arr, w, n, ar[j] - z);
    if (e + 1 <= y) {
      if (arr[e] >= ar[j] - z && ar[j] + f >= arr[e]) {
        v.push_back({j + 1, e + 1});
        n = e + 1;
      }
    } else
      break;
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
  return 0;
}
