#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m, X, Y;
pair<int, int> a[N], b[N];
vector<pair<int, int> > ans;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> X >> Y;
  for (int i = 1; i <= n; i++) cin >> a[i].first, a[i].second = i;
  for (int i = 1; i <= m; i++) cin >> b[i].first, b[i].second = i;
  sort(a + 1, a + 1 + n);
  sort(b + 1, b + 1 + m);
  int k = 0;
  for (int i = 1; i <= n; i++) {
    int j =
        lower_bound(b + 1 + k, b + 1 + m, pair<int, int>(a[i].first - X, -1)) -
        b;
    if (j <= m && b[j].first <= a[i].first + Y) {
      ans.push_back({a[i].second, b[j].second});
      k = j;
    }
  }
  cout << ans.size() << "\n";
  sort(ans.begin(), ans.end());
  for (auto x : ans) cout << x.first << " " << x.second << "\n";
  return 0;
}
