In the cricket-loving kingdom of Crickland, the national selectors are tasked with forming a legendary team for the upcoming tournament. They have a pool of N skilled batsmen and M talented bowlers, each with unique cricketing skills. The challenge is to pick the best possible team of 11 players that includes at least 4 batsmen and 4 bowlers, ensuring the team is balanced and strong.
Your goal is to help the selectors maximize the total cricketing skill of the team. The total skill is simply the sum of all the players’ skills. However, if it’s impossible to form a valid team with the required number of batsmen and bowlers, the selectors will need to know.
Can you find the maximum total cricketing skill for the team, or determine if forming such a team is impossible?
Each test case consists of multiple lines of input.
The first line of each test case contains two space-separated integers N and M - the number of batsmen and bowlers respectively.
The second line contains N space-separated integers, denoting the cricketing skills of the N batsmen.
The third line contains M space-separated integers, denoting the cricketing skills of the M bowlers.
Constraints
1 ≤ T ≤ 105
1 ≤ N, M ≤ 105
1 ≤ Ai, Bi ≤ 109
The sum of N and the sum of M over all test cases won't exceed 105
2
6 6
1 5 2 3 4 6
2 6 3 4 5 2
4 7
7 6 5 4
1 2 3 8 9 10 11
Sample Output
42
66
Explanation
Test case 1: Selectors can pick all the players apart from the batsmen with skill 1.
Test case 2: Selectors have no choice but to pick all the players.