#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int dsum, n, m, d[100001], to[10000];

int dist(int x, int y) { //x kara y
	if (x > y) swap(x, y);
	return min(y - x, x + dsum - y);
}

int main() {
	while (true) {
		cin >> dsum;
		if (dsum == 0) break;
		cin >> n >> m;
		d[0] = 0;
		FOR(i, 1, n) scanf("%d", &d[i]);
		d[n] = dsum;
		REP(i, m) scanf("%d", &to[i]);
		sort(d, d + n);
		sort(to, to + m);

		int pos = 0;
		long long ans = 0;
		REP(i, m) {
			while (!(d[pos] <= to[i] && d[pos + 1] >= to[i]))
				pos = (pos + 1) % n;

			int d1 = dist(d[pos], to[i]);
			int d2 = dist(d[(pos + 1) % n], to[i]);
			ans += min(d1, d2);
		}
		cout << ans << endl;
	}
	return 0;
}