Alice and Bob bought a very large integer, showed it off at a party, and carried it home together because it was too big for one person. On the way, both of them stumbled. The integer hit the pavement and broke into n positive integer pieces.
The purchase had already left them short on money, and after this they decided to separate. They divide the remaining pieces with a game. They take turns picking one piece at a time until no piece is left, and Alice picks first.
Each of them wants the sum of the pieces they take to be as large as possible, and both play optimally. Compute the total each of them ends up with.
Input
The input consists of two lines.
The first line contains the number of pieces n. (1≤n≤15)
The second line contains the values of the pieces a0,a1,…,an−1, separated by spaces. (1≤ai≤100)
Output
Print one line with the combined value of Alice's pieces and the combined value of Bob's pieces, separated by a space.