Midterm Madness
Throughout the semester, Parsa was regularly writing notes for each unit of coursework in his programming course. On his drive, he has PDF files, with the
th PDF corresponding to the
th teaching session, taught in order. Each file was saved by Parsa at the end of each unit. The sessions for the overall course are labelled
through to
.
Additionally, when studying for the midterm test and final exam, Parsa used a PDF merging tool to create a master document, making it easier to study everything at once. That is, the midterm test took place between the th and the
th unit (with
), and Parsa merged all PDFs from
to
together.
He also merged all files together at the end of the semester for the final exam, meaning that his drive contains
total files. However, his filesystem got messed up, so he can't tell which file is which anymore! Can you tell which file is which just by looking at their sizes? We know the sizes of all
files, and we know that merged file sizes are exactly equal to the sum of the files they were created from.
Input
The first line contains an integer , representing the number of course units which Parsa took notes for.
The following line contains space-separated integers
, representing the size of each file on his drive (all the course files in addition to the two merged files). Additionally, the properties regarding the merged files are guaranteed to hold, that is, one of the
file sizes will be the sum of
of the other files (the final exam merged file), and one of them will be the sum of
other files where
(the midterm merged file).
Output
Output the size of the midterm test merged file followed by the size of the merged final exam file, separated by a space.
Example
Input 1
2
11 5 6 5
Output 1
5 11
Input 2
10
50 33 21 201 356 20 11 18 79 14 15 95
Output 2
201 356
(These are the notes from the course units that came before the midterm)
(These are the notes from the entire course)
Comments