402577: GYM100812 D Dream of Sum

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Dream of Sumtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Sometimes you must fall in order to rise but I seemed to be already dead. The abyss behind me was getting the bigger the further I was moving away of it. I turned around, looked into it and saw myself at the very bottom of it. And at that moment I realized I was still alive.

I was sleeping, and the shadows of the past took advantage of it to take their shapes. I saw my wife and my daughters. They were dead. I also saw the sequence a1, ..., an of n integers. I had to find some consecutive elements in this sequence such that their sum was equal to zero. It was a matter of life and death. I had no time so I had to find the minimal possible number of such elements.

Input

The first line contains a single integer n (1 ≤ n ≤ 2·105) — the length of the sequence from the dream.

The second line contains n integers separated by spaces: ai ( - 109 ≤ ai ≤ 109) — the sequence itself.

Output

Output two integers separated by a space: the 1-based position in the sequence, starting from which the consecutive elements must be taken, and how many elements must be taken. If there are several possible answers, output any of them. If it's impossible to find the elements satisfying the statement, output a single integer –1 instead.

ExamplesInput
8
1 3 -2 -1 -5 2 2 1
Output
2 3
Input
7
5 -1 -1 -1 -1 -1 2
Output
5 3

加入题单

上一题 下一题 算法标签: