p00462 Pizza
problem

JOI Pizza sells pizza home delivery along the d-meter-long ring road that runs through the city center.

JOI Pizza has n stores S1, ..., Sn on the loop line. The head office is S1. The distance from S1 to Si when moving the loop line clockwise is set to di meters. D2 , ..., dn is an integer greater than or equal to 1 and less than or equal to d -1. D2, ..., dn are all different. Bake and deliver pizza at the shortest store.

The location of the delivery destination is represented by an integer k that is greater than or equal to 0 and less than or equal to d -1. This means that the distance from the head office S1 to the delivery destination in the clockwise direction is k meters. Pizza delivery is done along the loop line and no other road is allowed. However, the loop line may move clockwise or counterclockwise.

For example, if the location of the store and the location of the delivery destination are as shown in the figure below (this example corresponds to Example 1 of "I / O example").


<image>


The store closest to the delivery destination 1 is S2, so the delivery is from store S2. At this time, the distance traveled from the store is 1. Also, the store closest to delivery destination 2 is S1 (main store), so store S1 (main store). ) To deliver to home. At this time, the distance traveled from the store is 2.

Total length of the loop line d, Number of JOI pizza stores n, Number of orders m, N --1 integer representing a location other than the main store d2, ..., dn, Integer k1, .. representing the location of the delivery destination Given ., km, create a program to find the sum of all orders for each order by the distance traveled during delivery (ie, the distance from the nearest store to the delivery destination).



input

The input consists of multiple datasets. Each dataset is given in the following format.

The first line is a positive integer d (2 ≤ d ≤ 1000000000 = 109) that represents the total length of the loop line, the second line is a positive integer n (2 ≤ n ≤ 100000) that represents the number of stores, and the third line is A positive integer m (1 ≤ m ≤ 10000) is written to represent the number of orders. The n --1 lines after the 4th line are integers d2, d3, ..., dn that represent the location of stores other than the main store. (1 ≤ di ≤ d -1) is written in this order, and the integers k1, k2, ..., km (0 ≤ ki ≤ d) representing the delivery destination location are in the m lines after the n + 3rd line. --1) are written in this order.

Of the scoring data, for 40% of the points, n ≤ 10000 is satisfied. For 40% of the points, the total distance traveled and the value of d are both 1000000 or less. In the scoring data, the total distance traveled is 1000000000 = 109 or less.

When d is 0, it indicates the end of input. The number of data sets does not exceed 10.

output

For each data set, one integer representing the total distance traveled during delivery is output on one line.

Examples

Input

8
3
2
3
1
4
6
20
4
4
12
8
16
7
7
11
8
0


Output

3
3


Input

None


Output

None
```python
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0539
AC
"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline


def main(args):
    while True:
        d = int(input())        #  ??°??¶????????????
        if d == 0:
            break
        n = int(input())        #  ??¬????????????????????°
        m = int(input())        #  ??¨????????°
        cw_pos = [int(input()) for _ in range(n-1)]
        dests = [int(input()) for _ in range(m)]

        cw_pos.append(0)        #  ??¬????????????
        cw_pos.append(d)        #  ??°??¶??????1??¨??????????????¬????????????(??????)
        cw_pos.sort()

#        ccw_pos = [d-x for x in cw_pos] #  ??°??¶?????????????????£????????????????????????
#        ccw_pos.sort()


        total_distance = 0
        for t in dests:
            if t == 0:          #  ?????????????????????0?????\??£????????????bisect_right?????¨????????????????????§??????
                continue
            i = bisect_right(cw_pos, t)          #  ????¨?????????§??????????????????
            a1 = min(t-cw_pos[i-1], cw_pos[i]-t) #  ?????????????????????????????¢

#            j = bisect_right(ccw_pos, d-t)       #  ???????¨?????????§???????????¨?????????
#            a2 = min(d-t-ccw_pos[j-1], ccw_pos[j]-(d-t))

#            ans = min(a1, a2)
            total_distance += a1 #  ?????????????????????????????°OK

        print(total_distance)


if __name__ == '__main__':
    main(sys.argv[1:])
```