시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB123350.000%

문제

King Terenas ordered his minister to design a brain-stimulating game for prince Arthas – his son – to improve his mental capabilities. The minister designed a game in which there are N boxes labeled 1, … , N; each box has a lock which can be opened only using its unique key. Before the game starts, the minister puts copies of the key of each box i in the boxes i + 1 and i − 1, if they exist. Afterwards, D diamonds are placed inside D distinct boxes. Finally, all of the boxes are locked and Arthas is given the keys to some

입력

There are multiple test cases in the input. The first line of each test case starts with the integer N (1 ≤ N ≤ 500), the number of boxes, followed by M (1 ≤ M ≤ N), the number of keys given to Arthas, followed by D (0 ≤ D ≤ N), the number of diamonds. The M numbers on the next line represent the boxes whose keys are given to Arthas. Labels of the boxes containing the diamonds are listed on the next line. The input terminates with a line containing “0 0 0”.

출력

For each test case, write a single line containing the minimum number of boxes Arthas needs to open in order to collect all diamonds.

예제 입력 1

5 1 5
1
1 2 3 4 5
5 3 3
1 2 3
3 4 5
5 3 1
1 2 3
5
0 0 0

예제 출력 1

5
3
3