#include <bits/stdc++.h>
using namespace std;
const int MAX = 100 * 1000 + 100;
int sol[MAX];
int ans[MAX];
int vest[MAX];
int an, am, x, y;
int main() {
  int n, m;
  cin >> n >> m >> x >> y;
  for (int i = 0; i < n; i++) cin >> sol[i];
  for (int i = 0; i < m; i++) cin >> vest[i];
  while (an < n && am < m) {
    int less = sol[an] - x;
    int top = sol[an] + y;
    bool flag = true;
    while (flag && vest[am] <= top) {
      if (vest[am] >= less && am < m) {
        ans[an] = am + 1;
        am++;
        flag = false;
      } else
        am++;
    }
    an++;
  }
  int all = 0;
  for (int i = 0; i < n; i++)
    if (ans[i]) all++;
  cout << all << endl;
  for (int i = 0; i < n; i++)
    if (ans[i]) cout << i + 1 << " " << ans[i] << endl;
  return 0;
}
