#include <bits/stdc++.h>
using namespace std;
struct team {
  int problems;
  int penaltytime;
};
bool cmp(const team& left, const team& right) {
  return left.problems > right.problems ||
         (left.problems == right.problems &&
          left.penaltytime < right.penaltytime);
}
void solve_166A() {
  int n, k;
  team t[50];
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> t[i].problems >> t[i].penaltytime;
  }
  sort(t, t + n, cmp);
  k -= 1;
  int l(k), r(k);
  while (l > 0 && t[l - 1].problems == t[k].problems &&
         t[l - 1].penaltytime == t[k].penaltytime) {
    l -= 1;
  }
  while (r + 1 < n && t[r + 1].problems == t[k].problems &&
         t[r + 1].penaltytime == t[k].penaltytime) {
    r += 1;
  }
  cout << r - l + 1 << endl;
}
void solve_161A() {
  int n, m, x, y;
  int soldiers[100001], vests[100001];
  cin >> n >> m >> x >> y;
  for (int i = 0; i < n; i++) cin >> soldiers[i];
  for (int i = 0; i < m; i++) cin >> vests[i];
  int countt = 0;
  for (int i = 0, j = 0; i < n && j < m;) {
    if (soldiers[i] - x > vests[j]) {
      j++;
    } else if (soldiers[i] + y < vests[j]) {
      i++;
    } else {
      soldiers[countt] = ++i;
      vests[countt] = ++j;
      countt++;
    }
  }
  cout << countt << endl;
  for (int i = 0; i < countt; i++)
    cout << soldiers[i] << " " << vests[i] << endl;
}
int main() {
  solve_161A();
  return 0;
}
