Amin has participated in the class of "Silou's case and Galva's theory". Dr. Taleb in…
- User
Amin has participated in the class of "Silou's case and Galva's theory". Dr. Taleb in this class n n has sent the pdf file of the pamphlet to the students. file i I am related to the meeting i is i The sessions were taught in order and the handout of each lesson was placed on the system immediately after the end of that class. We know that Amin downloaded the booklets of each lesson immediately after being placed in the system and saved them in a special folder for the booklets of this lesson.
But Amin has an efficient tool that glues these pamphlets together and he only uses this tool twice, once for the mid-term exam and once for the end-of-semester exam.
That is, if the midterm exam is between sessions m m ( 1 ≤ m ≤ n
1 1≤m≤n−1) and session m + 1 m+1 class to be held, Amin to study, all pamphlets related to the session 1 1 to m m and creates a new file. (To read more easily.)
Also, Amin for the final exam, the booklet is complete n Concatenates n sessions in order and creates a new file.
Description of the image
Now Amin has graduated, but the folder related to Amin's pamphlets for this course remains. That is, this folder contains n + 2 There are n+2 files, but it is not clear which of these files are related to which sessions and which is the mid-term file and which is the end-term file.
The only thing that is known is the size of the files. And we know that the size of the file obtained by joining several other files will be equal to the total size of those files.
Now we want you to have the volume of this n + 2 Specify n+2 files, volume of midterm and end of semester handouts.
input In the first line, enter a positive integer n n is given. which indicates the number of teaching sessions. 1 ≤ n ≤ 100 , 000 1≤n≤100,000 In the second line of the input n + 2 n+2 positive integers a 1 , a 2 , … , a n + 2 a 1 , a 2 ,...,a n+2 It shows the size of Amin's files. 1 ≤ a i ≤ 1 0 9 1≤a i ≤10 9
It is guaranteed that there is always an answer to this problem.
output In the only output line, print two positive integers separated by a space, the first number indicating the size of the midterm file and the second number indicating the size of the final file.
examples Sample entry 1 2 11 5 6 5 Plain text Sample output 1 5 11 Plain text If we assume the file size of the first session 5 5 and the second session 6 6 and the midterm was held between these two sessions, the size of the midterm file 5 5 and the size of the end-of-semester file 5 + 6
11 5+6=11 will be.
Sample input 2 6 1 2 3 6 4 5 6 21 Plain text Sample output 2 6 21 Plain text If we assume, the size of the session file k I am equal k be k (for each 1 ≤ k ≤ 5 1≤k≤5) and the midterm exam is held between the third and fourth sessions, the size of the midterm file is equal to 1 + 2 + 3
6 1+2+3=6 and the end of the semester is equal 1 + 2 + 3 + 4 + 5 + 6
- Assistant
To solve this problem, we need to identify the sizes of the files generated by the mid-term and end-of-semester exams. Let's outline the steps required to determine these two file sizes:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.