#include <bits/stdc++.h>
using namespace std;
bool is_prime(long long x) {
  if (x == 1) return false;
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
bool is_palindrome(string s1) {
  int l = s1.length();
  for (int i = 0; i < l / 2; i++)
    if (s1[i] != s1[l - i - 1]) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<int> a, b;
  vector<pair<int, int>> v;
  for (long long int i = 0; i < n; i++) {
    int p;
    cin >> p;
    a.push_back(p);
  }
  for (long long int i = 0; i < m; i++) {
    int q;
    cin >> q;
    b.push_back(q);
  }
  int l = 0, r = 0;
  while (r < m && l < n) {
    if ((a[l] - x) <= b[r] && b[r] <= (a[l] + y)) {
      v.push_back({l, r});
      l++;
      r++;
    } else if ((a[l] - x) >= b[r]) {
      r++;
    } else if ((a[l] + y) <= b[r]) {
      l++;
    }
  }
  cout << v.size() << "\n";
  for (long long int i = 0; i < v.size(); i++) {
    cout << v[i].first + 1 << " " << v[i].second + 1 << "\n";
  }
  return 0;
}
