Wrestling Team Selection

No attempts yetTime limit1sMemory limit128 MB

Problem

The national wrestling association is dividing its athletes into two teams for the upcoming Olympic trials.

Every athlete belongs to exactly one of the two teams. The sizes of the two teams differ by at most 1. Under those conditions, the difference between the two total weights must be as small as possible.

Given the weight of every athlete, divide them into teams as described and compute the total weight of each team.

Input

The first line contains the number of athletes nn. Each of the next nn lines contains the weight of one athlete, an integer that is at least 11 and at most 450450. The association has no more than 100100 athletes.

Output

Print the total weight of the two teams on one line, separated by a space. Print the smaller total first.