#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 7;
const long long mod = 1e9 + 7;
void solve() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<int> a(n + 1), b(m + 1);
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) cin >> b[i];
  int i = 1, j = 1;
  vector<pair<int, int> > res;
  while (i <= n && j <= m) {
    if (a[i] - x <= b[j] && a[i] + y >= b[j]) {
      res.push_back({i++, j++});
      continue;
    }
    if (a[i] > b[j]) {
      ++j;
    } else {
      ++i;
    }
  }
  cout << res.size() << "\n";
  for (auto i : res) cout << i.first << " " << i.second << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tt = 1;
  while (tt--) {
    solve();
  }
}
