#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-10;
template <typename T, typename S>
vector<T>& operator<<(vector<T>& a, S b) {
  a.push_back(b);
  return a;
}
template <typename T>
void operator>>(vector<T>& a, int b) {
  while (b--)
    if (!a.empty()) a.pop_back();
}
bool isprime(int n) {
  if (n < 2) return false;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
long long b_pow(long long x, long long n) {
  return n ? b_pow(x * x, n / 2) * (n % 2 ? x : 1) : 1ll;
}
string itos(int n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<int> a(n), b(m);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  int ans = 0, h = 0;
  vector<pair<int, int> > res;
  for (int i = 0; i < a.size(); i++) {
    if (h >= b.size()) break;
    while (h < b.size() && b[h] < a[i] - x) h++;
    if (h >= b.size()) break;
    if (a[i] + y >= b[h]) res.push_back(make_pair(i + 1, h + 1)), h++;
    if (h >= b.size()) break;
  }
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); i++)
    cout << res[i].first << " " << res[i].second << endl;
}
