Several people want to play hockey, so they use the following algorithm to split themselves into teams. There are teams captains, numbered from 1 to teams, who select players for their respective teams. The draft process is split into several rounds, which are enumerated starting from 1. Captain 1 starts round 1 of the draft by picking a single player, followed by captain 2 and all the other captains in order of ascending indices. When captain teams makes his pick, round 1 is over. If any unpicked players remain, the draft continues with round 2. In round 2, all captains make their picks in reverse order - so captain teams starts the round, and captain 1 ends it. Rounds 3, 5 and all other rounds with odd numbers go similar to round 1, while all rounds with even numbers go similar to round 2. For example, if there are 4 captains, they'll pick players in the following order: 1, 2, 3, 4, 4, 3, 2, 1, 1, 2, 3, ... The draft is over when all players are picked.
One of the captains wants to have a team which will use powerplay tactics during its games, while all the other captains want to have regular teams. Powerplay skills are different from the usual skills required for playing hockey. You will be given ints usualSkills and powerplaySkills. The i-th elements of usualSkills and powerplaySkills represent the usual and powerplay skills, respectively, of the i-th player.
During the draft, a captain of a regular team will always pick the player with the highest usual skill among all remaining players. If several players have the same maximal usual skill, the player with the higher powerplay skill will be picked. The captain of the powerplay team will make his picks in such a way that maximizes the final total powerplay skill in his team. This means he won't necessarily always pick the remaining player with the highest powerplay skill (see examples). You will be given an int ind - the 1-based number of the captain who wants to build the powerplay team. Return the total powerplay skill of the team he chooses.