def find(l, e, start, end):

	mid = (start+end)//2

	if (l[mid] == e):

		return (e, e)

	elif (l[mid] > e):

		if (l[mid-1] < e):

			return (l[mid-1], l[mid])

		return find(l, e, start, mid)

	elif (l[mid] < e):

		if (l[mid+1] > e):

			return (l[mid], l[mid+1])

		return find(l, e, mid, end)



def print_sum():

	d = int(input())

	if d == 0: return False

	n, m = int(input()), int(input())

	S = [int(input()) for _ in range(n-1)]

	K = [int(input()) for _ in range(m)]

	S = [0] + sorted(S) + [d]

	sum = 0

	for k in K:

		low, high = find(S, k, 0, len(S))

		sum += min(k-low, high-k)

	print(sum)

	return True



while (print_sum()):

	pass
def find(l, e):

	start, end = 0, len(l)

	while True:

		mid = (start+end)//2

		if l[mid] == e: 

			return (e, e)

		elif (l[mid] > e):

			if (l[mid-1] < e):

				return (l[mid-1], l[mid])

			end = mid

			continue

		elif (l[mid] < e):

			if (l[mid+1] > e):

				return (l[mid], l[mid+1])

			start = mid



def print_sum():

	d = int(input())

	if d == 0: return False

	n, m = int(input()), int(input())

	S = [int(input()) for _ in range(n-1)]

	K = [int(input()) for _ in range(m)]

	S = [0] + sorted(S) + [d]

	sum = 0

	for k in K:

		low, high = find(S, k)

		sum += min(k-low, high-k)

	print(sum)

	return True



while (print_sum()):

	pass
def find(l, e, start, end):
    mid = (start + end) // 2
    if l[mid] == e:
        return (e, e)
    elif l[mid] > e:
        if l[mid - 1] < e:
            return (l[mid - 1], l[mid])
        return find(l, e, start, mid)
    elif l[mid] < e:
        if l[mid + 1] > e:
            return (l[mid], l[mid + 1])
        return find(l, e, mid, end)


def print_sum():
    d = int(input())
    if d == 0:
        return False
    n, m = int(input()), int(input())
    S = [int(input()) for _ in range(n - 1)]
    K = [int(input()) for _ in range(m)]
    S = [0] + sorted(S) + [d]
    sum = 0
    for k in K:
        low, high = find(S, k, 0, len(S))
        sum += min(k - low, high - k)
    print(sum)
    return True


while print_sum():
    pass

def find(l, e):
    start, end = 0, len(l)
    while True:
        mid = (start + end) // 2
        if l[mid] == e:
            return (e, e)
        elif l[mid] > e:
            if l[mid - 1] < e:
                return (l[mid - 1], l[mid])
            end = mid
            continue
        elif l[mid] < e:
            if l[mid + 1] > e:
                return (l[mid], l[mid + 1])
            start = mid


def print_sum():
    d = int(input())
    if d == 0:
        return False
    n, m = int(input()), int(input())
    S = [int(input()) for _ in range(n - 1)]
    K = [int(input()) for _ in range(m)]
    S = [0] + sorted(S) + [d]
    sum = 0
    for k in K:
        low, high = find(S, k)
        sum += min(k - low, high - k)
    print(sum)
    return True


while print_sum():
    pass

-def find(l, e, start, end): -    mid = (start + end) // 2 -    if l[mid] == e: -        return (e, e) -    elif l[mid] > e: -        if l[mid - 1] < e: -            return (l[mid - 1], l[mid]) -        return find(l, e, start, mid) -    elif l[mid] < e: -        if l[mid + 1] > e: -            return (l[mid], l[mid + 1]) -        return find(l, e, mid, end) +def find(l, e): +    start, end = 0, len(l) +    while True: +        mid = (start + end) // 2 +        if l[mid] == e: +            return (e, e) +        elif l[mid] > e: +            if l[mid - 1] < e: +                return (l[mid - 1], l[mid]) +            end = mid +            continue +        elif l[mid] < e: +            if l[mid + 1] > e: +                return (l[mid], l[mid + 1]) +            start = mid -        low, high = find(S, k, 0, len(S)) +        low, high = find(S, k)