Field Trip

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

You and your classmates are going on an exciting field trip to a downtown museum. Because the museum is an hour away, three buses of identical capacity and a van are dispatched as a means of transportation to the museum and back. The buses will first start loading only students, and once all students have been loaded then teachers will begin to fill in the remaining spots on the buses. Any remaining teachers will ride on the van. To make the bus ride more exciting, all the students are hoping for a "teacher free bus ride"! A teacher free bus ride is when none of the teachers are on a bus.

Students are grouped in nn class sections of different sizes. Each class section is assigned a number from 11 to nn. All students in one class section must ride on the same bus. The buses will board class sections in increasing order by number. In other words, the first bus will load sections numbered 11 to ii, the second bus will load sections numbered i+1i+1 to jj, and the third bus will load the sections numbered j+1j+1 to nn. Every bus must have at least one class section assigned to it.

Given the sizes of each of the class sections, determine if it is possible to load students onto 33 identical buses and end up with a "teacher free bus ride!"

입력

The first line of input contains one integer NN, the number of class sections (3N1,000,0003 \le N \le 1,000,000). The second line of input contains NN integers, the ithi^{\text{th}} integer represents the size of class section with number ii. Class section sizes can range from \[1,10,000]\[1, 10\\,000].

출력

If it is possible to load the students onto three identical buses in the above-described fashion and have a teacher free bus ride, then output two integers ii and jj (1i<j<n1 \le i < j < n) where ii is the number of the class section which is to be loaded last into the first bus, and jj is the class section which is to be loaded last into the second bus. We can assume the third bus will load class sections j+1j+1 to nn.

If it is not possible, print "-1".