Alice and Bob have bags of candies, described by an array : bag contains candies.
Alice first arranges all the bags in any order. They then open the bags in that order, taking turns, starting with Alice.
Whenever a bag is opened, its candies are divided as evenly as possible between Alice and Bob. If there is one extra candy, the person who opened that bag receives it.
All bags must be opened. Candies from different bags cannot be combined before they are divided.
For each test case, find the maximum total number of candies Alice can receive.
Alice can arrange the bags as . She opens the first and third bags and receives candies in total. This is the maximum possible.
With the bags in the given order, Alice receives candies. Every ordering gives her the same total in this case.
Alice opens the only bag. She receives candies, and Bob receives .
Every bag can be split equally. Alice receives candies, regardless of the order.
Alice can arrange the bags as . She receives candies in total, which is the maximum possible.