#include <bits/stdc++.h>
using namespace std;
int dx[] = {+1, -1, 0, 0};
int dy[] = {0, 0, +1, -1};
int dx2[] = {+1, -1, 0, 0, +1, +1, -1, -1};
int dy2[] = {0, 0, +1, -1, +1, -1, -1, +1};
long long squ(long long x) { return (x * x); }
long long power(long long bs, long long k) {
  long long x = 1, y = bs;
  if (k == 0) return 1;
  while (k > 0) {
    if (k % 2 == 1) x = (x * y);
    y *= y;
    k /= 2;
  }
  return x;
}
bool cmpare(const pair<int, int> &p, const pair<int, int> &q) {
  return (p.first < q.first);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout.unsetf(ios::floatfield);
  cout.precision(6);
  cout.setf(ios::fixed, ios::floatfield);
  ;
  int n, m, i, j, x, y;
  cin >> n >> m >> x >> y;
  int a[100100], b[100100];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < m; i++) {
    cin >> b[i];
  }
  vector<pair<int, int> > ans;
  i = 0;
  j = 0;
  while (i < n && j < m) {
    if (a[i] - x > b[j]) {
      j++;
    } else if (a[i] + y < b[j])
      i++;
    else {
      ans.push_back(pair<int, int>(i, j));
      i++;
      j++;
    }
  }
  int k = ans.size();
  cout << k << endl;
  for (i = 0; i < k; i++)
    cout << ans[i].first + 1 << ' ' << ans[i].second + 1 << endl;
  return 0;
}
