#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

long long S[1000000], D[1000000];
long long d, n, m, sum, Left, Right, Mid, a, b;

int main() {
	while (true) {
		sum = 0;
		cin >> d;
		if (d == 0) { break; }
		cin >> n >> m;
		for (int i = 0; i < n - 1; i++) {
			cin >> S[i];
		}
		for (int i = 0; i < m; i++) {
			cin >> D[i];
		}
		sort(S, S + n);

		for (int i = 0; i < m; i++) {
			Left = 0; Right = n - 1;
			for (int j = 0; j < 50; j++) {
				Mid = (Left + Right) / 2;
				if (S[Mid] <= D[i] && S[Mid + 1]>D[i]) {
					break;
				}
				if (S[Mid] < D[i]) { Left = Mid + 1; }
				if (S[Mid] > D[i]) { Right = Mid; }
			}
			a = abs(D[i] - S[Mid%d]);
			b = abs(S[(Mid + 1) % n] - D[i]);
			if (b == D[i]) {
				b = min(b, d - b);
			}
			sum += min(a, b);
		}
		cout << sum << endl;
	}
}