#include <bits/stdc++.h>
using namespace std;
int n, m;
pair<pair<int, int>, int> to[100010];
int arr[100010];
int main() {
  int x, y;
  int val;
  scanf("%d %d %d %d", &n, &m, &x, &y);
  for (int i = 0; i < n; i++) {
    scanf("%d", &val);
    to[i] = make_pair(make_pair(max(val - x, 1), val + y), i);
  }
  for (int i = 0; i < m; i++) scanf("%d", &arr[i]);
  sort(to, to + n);
  sort(arr, arr + m);
  int cur = 0;
  int ini, fin;
  vector<pair<int, int> > res;
  for (int i = 0; i < n; i++) {
    ini = to[i].first.first;
    fin = to[i].first.second;
    while (cur < m && ini > arr[cur]) cur++;
    if (cur < m && arr[cur] <= fin) {
      res.push_back(make_pair(to[i].second, cur));
      cur++;
    }
  }
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); i++)
    cout << res[i].first + 1 << " " << res[i].second + 1 << endl;
  return 0;
}
