#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  if (!y) return x;
  return gcd(y, x % y);
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
bool sortbysecinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second > b.second);
}
bool sortbysize(string &s1, string &s2) { return s1.size() < s2.size(); }
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
bool sortcol(const vector<int> &v1, const vector<int> &v2) {
  return v1[0] < v2[0];
}
int proceed() {
  long long n, m, x, y, i, j, cnt = 0;
  cin >> n >> m >> x >> y;
  vector<long long> a(n), b(m);
  vector<pair<long long, long long>> p;
  for (i = 0; i < n; ++i) cin >> a[i];
  for (i = 0; i < m; ++i) cin >> b[i];
  for (i = 0, j = 0; i < n && j < m;) {
    if (b[j] >= a[i] - x && b[j] <= a[i] + y) {
      p.push_back(make_pair(i + 1, j + 1));
      ++cnt;
      ++i;
      ++j;
    } else if (b[j] < a[i] - x)
      ++j;
    else if (b[j] > a[i] + y)
      ++i;
  }
  cout << cnt << "\n";
  if (cnt) {
    for (auto i : p) cout << i.first << " " << i.second << "\n";
  }
  return 0;
}
int main() {
  int t = 1, i = 0;
  while (t--) {
    proceed();
  }
  return 0;
}
