#include <bits/stdc++.h>
using namespace std;
int main (){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k[3], mod[] = {4, 5, 8};
cin >> n;
for (int i = 0; i < 3; ++i) {
cin >> k[i];
}
int a[n];
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
vector<vector<int>> dp(3, vector<int>(n, 1));
for (int i = 1; i < n; ++i) {
for (int j = 0; j < 3; ++j) {
if (abs((a[i] % mod[j]) - (a[i - 1] % mod[j])) <= k[j]) {
dp[j][i] = dp[j][i - 1] + 1;
}
}
}
array<int, 2> ans{1, 0};
for (int r = 0; r < n; ++r) {
int l = r - min({dp[0][r], dp[1][r], dp[2][r]}) + 1;
if (r - l > ans[1] - ans[0]) {
ans = {l, r};
}
}
cout << ans[0] + 1 << " " << ans[1] + 1;
return 0;
}
Copy