#include <cstdio>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;

int d, n, m, k, s, e, mid, ans;
int p[200000];

int main(){
	while(scanf("%d", &d),d){
		ans = 0;
		scanf("%d%d", &n, &m);
		rep(i,n-1) scanf("%d", &p[i]);
		p[n-1] = 0; p[n] = d; p[n+1] = d+1;
		sort(p,p+n+2);
		rep(i,m){
			scanf("%d", &k);
			s = 0; e = n+1;
			while(true){
				mid = (s+e)/2;
				if(e-s == 1) break;
				if(p[mid] <= k) s = mid;
				else e = mid;
			}
			ans += min(k-p[s],p[e]-k);
		}
		printf("%d\n", ans);
	}
}