#include <bits/stdc++.h>
using namespace std;
bool cmp(int x, int y) { return x > y; }
long long a[100005], v[100005];
pair<long long, long long> p[100005];
int m, n, x, y;
int main() {
  cin >> n >> m >> x >> y;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> v[i];
  }
  int ans = 0;
  for (int i = 1, j = 1, k = 1; i <= n && j <= m;) {
    if (a[i] - x > v[j]) {
      j++;
    } else if (a[i] + y < v[j]) {
      i++;
    } else
      i++, j++, ans++, p[k].first = i - 1, p[k++].second = j - 1;
  }
  cout << ans << endl;
  for (int i = 1; i <= ans; i++) {
    cout << p[i].first << " " << p[i].second << endl;
  }
  return 0;
}
