#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(0);
  vector<pair<int, int> > answer;
  int soldiers, vests, x, y;
  cin >> soldiers >> vests >> x >> y;
  int soldiers_sizes[soldiers];
  long long vest_sizes[vests];
  for (int i = 0; i < soldiers; i++) {
    cin >> soldiers_sizes[i];
  }
  for (int i = 0; i < vests; i++) {
    cin >> vest_sizes[i];
  }
  int soldiers_pointer = 0;
  int vests_pointer = 0;
  while (vests_pointer < vests && soldiers_pointer < soldiers) {
    long long down = soldiers_sizes[soldiers_pointer] - x;
    long long up = soldiers_sizes[soldiers_pointer] + y;
    while (vests_pointer < vests) {
      if (vest_sizes[vests_pointer] >= down &&
          vest_sizes[vests_pointer] <= up) {
        answer.push_back(make_pair(soldiers_pointer + 1, vests_pointer + 1));
        vests_pointer++;
        break;
      } else if (vest_sizes[vests_pointer] < down) {
        vests_pointer++;
      } else {
        break;
      }
    }
    soldiers_pointer++;
  }
  cout << answer.size() << '\n';
  for (int i = 0; i < answer.size(); i++) {
    cout << answer[i].first << ' ' << answer[i].second << '\n';
  }
  return 0;
}
