Sample Problem

Rotation Pool

Time Limit : 1000ms

Problem Description

Rotation pool is one of the basic types of pool game (billiard) played by two players using 15 balls numbered from 1 to 15. The objective is to collect as many points as you can by pocketing balls. If you pockets ball number p then you will get p points added to your total score. A player gets his turn if the other player made a foul or failed to pocket any ball in his shoot. The game ends when one of the player’s score is more than 60 which is more than half of the available points, and so he is decided as the winner.

In the example below, Player A manages to pocket balls number 1, 2, 4, 7, 11, 12, and 13. In the other hand, Player B manages to pocket balls number 3, 5, 6, 8, 9, 10, 14, and 15.

 Player Pocketed Balls Total A 1 2 4 7 11 12 13 50 B 3 5 6 8 9 10 14 15 70

So, the total score for A is 1 + 2 + 4 + 7 + 11 + 12 + 13 = 50, and for B is 3 + 5 + 6 + 8 + 9 + 10 + 14 + 15 = 70. That means this game is won by Player B who leads by 20 points.

Given the data of which ball pocketed by each player, write a program to calculate the difference between the winner score and the loser score. In this problem, we will assume the game still continued even if there is a player who scores more than 60.

Input Specification

Input consists of several test cases. Each test case contains two lines. The first line contains an integer N (0 ≤ N ≤ 15), the number of balls pocketed by first player. The second line contains 15 integers (1 to 15) each separated by a single space. The first N integers are the balls pocketed by first player, and the rest 15-N integers are balls which pocketed by the second player.

Output Specification

For each test case, output the difference between the winner score and the loser score in a single line.

Sample Input

7

1 2 4 7 11 12 13 3 5 6 8 9 10 14 15

6

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

Sample Output

20

30