#include <iostream>
using namespace std;
int n, k1, k2, k3, a[200000], ansl, ansr, l, r;
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
cin >> n >> k1 >> k2 >> k3;
for (int i = 0; i < n; ++i)
cin >> a[i];
for (int i = 1; i < n; ++i) {
bool f1, f2, f3;
f1 = abs((a[i] % 4) - (a[i - 1] % 4)) <= k1;
f2 = abs((a[i] % 5) - (a[i - 1] % 5)) <= k2;
f3 = abs((a[i] % 8) - (a[i - 1] % 8)) <= k3;
if (f1 && f2 && f3) {
++r;
if (r - l > ansr - ansl) {
ansr = r;
ansl = l;
}
}
else {
l = r + 1;
r = l;
}
}
cout << ansl + 1 << " " << ansr + 1 << endl;
}
Copy