beecrowd | 2021

Christmas Lights

By Leonardo Falk, URI BR Brazil

Timelimit: 1

It's Christmas and it is time to arrange the house to reflect the mood of the festivities of the holiday season. Jon's family has already started to decorate the house and his job is to hang countless Christmas lights around the house of a rectangle shape. However these lamps are somewhat boring, after storing them throughout the year they end broken or some other burning. He is using the rectangle shaped lights model.

Jon will buy all the spare lights that need to be replaced because he doesn't know that the first column of lights runs in a parallel way while each line works in series making him think that all from a certain point are burned. What he does is actually telling, in order, the number of lights until you find one that does not light up more and then write down the number on paper and then jumps to the next line restarting the count.

For example a 5x5 grid there are two positions that he found 5 and 1, this would have the following representation:

****-
- - - - -
*****
*****
*****

So the amount that Jon should buy is 6.

Your task is to tell you how many lights are off from the positions that Jon wrote down so he can buy and replace them.

Input

The input consists of multiple test cases that begin with a line with three integers M, N and P (2 ≤ M, N ≤ 500 and 1 ≤ P N) representing respectively height, width and number positions he found. The next P lines contains a number Q (1 ≤ QM*N) which are the positions of each light off. The input ends when N = M = P = 0.

Output

For each case print the phrase "Lights: X" where X is the total number of lights that Jon should buy.

Input Sample Output Sample

10 5 2

5

1

10 10 10

1

2

3

4

5

5

4

3

2

1

0 0 0

Lights: 6

Lights: 80