#include
#include
int main() {
int x;
int prethoden_broj;
int prv = 0;
int maksimalen_zbir = 0;
int reden_broj;
int red = 0;
while(scanf("%d", &x)) {
red++;
if(prv == 0) {
prethoden_broj = x;
prv = 1;
}
else {
if(x < 0 && prethoden_broj < 0) {
break;
}
if(maksimalen_zbir < prethoden_broj + x) {
maksimalen_zbir = prethoden_broj + x;
reden_broj = red;
}
prethoden_broj = x;
}
}
printf("%d %d", reden_broj, reden_broj - 1);
return 0;
}